def _send_request(self, message):
        if message.device_tokens == None or message.notification == None:
            logging.error('Message must contain device_tokens and notification.')
            return False

        # Check for resend_after
        retry_after = self._get_memcached(RETRY_AFTER)
        if retry_after != None and retry_after > datetime.now():
            logging.warning('RETRY_AFTER: ' + repr(retry_after) + ', requeueing message: ' + repr(message))
            self._requeue_message(message)
            return

        
        # Build request
        headers = {
                   'Authorization': 'key=' + GCM_CONFIG['gcm_api_key'],
                   'Content-Type': 'application/json'
                   }
        
        gcm_post_json_str = ''
        try:
            gcm_post_json_str = message.json_string()
        except:
            logging.exception('Error generating json string for message: ' + repr(message))
            return
        
        logging.info('Sending gcm_post_body: ' + repr(gcm_post_json_str))
        
        request = urllib2.Request(GOOGLE_GCM_SEND_URL, gcm_post_json_str, headers)
 
        # Post
        try:
            resp = urllib2.urlopen(request)
            resp_json_str = resp.read()
            resp_json = json.loads(resp_json_str)
            logging.info('_send_request() resp_json: ' + repr(resp_json))
            
#            multicast_id = resp_json['multicast_id']
#            success = resp_json['success']
            failure = resp_json['failure']
            canonical_ids = resp_json['canonical_ids']
            results = resp_json['results']
            
            # If the value of failure and canonical_ids is 0, it's not necessary to parse the remainder of the response.
            if failure == 0 and canonical_ids == 0:
                # Success, nothing to do
                return
            else:
                # Process result messages for each token (result index matches original token index from message) 
                result_index = 0
                for result in results:
                    
                    if 'message_id' in result and result in 'registration_id':
                        # Update device token
                        try:
                            old_device_token = message.device_tokens[result_index]
                            new_device_token = result['registration_id']
                            self.update_token(old_device_token, new_device_token)
                        except:
                            logging.exception('Error updating device token')
                    
                    elif 'error' in result:
                        # Handle GCM error
                        error_msg = result.get('error')
                        try:
                            device_token = message.device_tokens[result_index]
                            self._on_error(device_token, error_msg, message)
                        except:
                            logging.exception('Error handling GCM error: ' + repr(error_msg))
                    
                    result_index += 1
                
        except urllib2.HTTPError, e:
            self._incr_memcached(TOTAL_ERRORS, 1)
            
            if e.code == 400:
                logging.error('400, Invalid GCM JSON message: ' + repr(gcm_post_json_str))
            elif e.code == 401:
                logging.error('401, Error authenticating with GCM. Retrying message. Might need to fix auth key!')
                self._requeue_message(message)
            elif e.code == 500:
                logging.error('500, Internal error in the GCM server while trying to send message: ' + repr(gcm_post_json_str))
            elif e.code == 503:
                retry_seconds = int(resp.headers.get('Retry-After')) or 10
                logging.error('503, Throttled. Retry after delay. Requeuing message. Delay in seconds: ' + str(retry_seconds))
                retry_timestamp = datetime.now() + timedelta(seconds=retry_seconds)
                self._set_memcached(RETRY_AFTER, retry_timestamp)
                self._requeue_message(message)
            else:
                logging.exception('Unexpected HTTPError: ' + str(e.code) + " " + e.msg + " " + e.read())
dataset/ETHPy150Open gregbayer/gae-python-gcm/gae_python_gcm/gcm.py/GCMConnection._send_request/swapped operands of `in`