def send(self, data=None, headers=None, ttl=<NUM_LIT:0>, gcm_key=None, reg_id=None,<EOL>content_encoding="<STR_LIT>", curl=False, timeout=None):
<EOL>if headers is None:<EOL><INDENT>headers = dict()<EOL><DEDENT>encoded = {}<EOL>headers = CaseInsensitiveDict(headers)<EOL>if data:<EOL><INDENT>encoded = self.encode(data, content_encoding)<EOL>if "<STR_LIT>" in encoded:<EOL><INDENT>crypto_key = headers.get("<STR_LIT>", "<STR_LIT>")<EOL>if crypto_key:<EOL><INDENT>crypto_key += '<STR_LIT:;>'<EOL><DEDENT>crypto_key += (<EOL>"<STR_LIT>" + encoded["<STR_LIT>"].decode('<STR_LIT:utf8>'))<EOL>headers.update({<EOL>'<STR_LIT>': crypto_key<EOL>})<EOL><DEDENT>if "<STR_LIT>" in encoded:<EOL><INDENT>headers.update({<EOL>'<STR_LIT>': "<STR_LIT>" + encoded['<STR_LIT>'].decode('<STR_LIT:utf8>')<EOL>})<EOL><DEDENT>headers.update({<EOL>'<STR_LIT>': content_encoding,<EOL>})<EOL><DEDENT>if gcm_key:<EOL><INDENT>if len(gcm_key) < <NUM_LIT:100>:<EOL><INDENT>endpoint = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>endpoint = '<STR_LIT>'<EOL><DEDENT>reg_ids = []<EOL>if not reg_id:<EOL><INDENT>reg_id = self.subscription_info['<STR_LIT>'].rsplit('<STR_LIT:/>', <NUM_LIT:1>)[-<NUM_LIT:1>]<EOL><DEDENT>reg_ids.append(reg_id)<EOL>gcm_data = dict()<EOL>gcm_data['<STR_LIT>'] = reg_ids<EOL>if data:<EOL><INDENT>gcm_data['<STR_LIT>'] = base64.b64encode(<EOL>encoded.get('<STR_LIT:body>')).decode('<STR_LIT:utf8>')<EOL><DEDENT>gcm_data['<STR_LIT>'] = int(<EOL>headers['<STR_LIT>'] if '<STR_LIT>' in headers else ttl)<EOL>encoded_data = json.dumps(gcm_data)<EOL>headers.update({<EOL>'<STR_LIT>': '<STR_LIT>'+gcm_key,<EOL>'<STR_LIT:Content-Type>': '<STR_LIT:application/json>',<EOL>})<EOL><DEDENT>else:<EOL><INDENT>encoded_data = encoded.get('<STR_LIT:body>')<EOL>endpoint = self.subscription_info['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' not in headers or ttl:<EOL><INDENT>headers['<STR_LIT>'] = str(ttl or <NUM_LIT:0>)<EOL><DEDENT>if curl:<EOL><INDENT>return self.as_curl(endpoint, encoded_data, headers)<EOL><DEDENT>return self.requests_method.post(endpoint,<EOL>data=encoded_data,<EOL>headers=headers,<EOL>timeout=timeout)<EOL>
Encode and send the data to the Push Service.

        :param data: A serialized block of data (see encode() ).
        :type data: str
        :param headers: A dictionary containing any additional HTTP headers.
        :type headers: dict
        :param ttl: The Time To Live in seconds for this message if the
            recipient is not online. (Defaults to "0", which discards the
            message immediately if the recipient is unavailable.)
        :type ttl: int
        :param gcm_key: API key obtained from the Google Developer Console.
            Needed if endpoint is https://android.googleapis.com/gcm/send
        :type gcm_key: string
        :param reg_id: registration id of the recipient. If not provided,
            it will be extracted from the endpoint.
        :type reg_id: str
        :param content_encoding: ECE content encoding (defaults to "aes128gcm")
        :type content_encoding: str
        :param curl: Display output as `curl` command instead of sending
        :type curl: bool
        :param timeout: POST requests timeout
        :type timeout: float or tuple