'Makes a HTTP request to GCM servers with the constructed payload
:param data: return value from construct_payload method
:param session: requests.Session object to use for request (optional)
:raises GCMMalformedJsonException: if malformed JSON request found
:raises GCMAuthenticationException: if there was a problem with authentication, invalid api key
:raises GCMConnectionException: if GCM is screwed'

def make_request(self, data, is_json=True, session=None):

    headers = {'Authorization': ('key=%s' % self.api_key)}
    if is_json:
        headers['Content-Type'] = 'application/json'
    else:
        headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
    GCM.log('Request    URL:    {0}', self.url)
    GCM.log('Request    headers:    {0}', headers)
    GCM.log('Request    proxy:    {0}', self.proxy)
    GCM.log('Request    timeout:    {0}', self.timeout)
    GCM.log('Request    data:    {0}', data)
    GCM.log('Request    is_json:    {0}', is_json)
    new_session = None
    if (not session):
        session = new_session = requests.Session()
    try:
        response = session.post(self.url, data=data, headers=headers, proxies=self.proxy, timeout=self.timeout)
    finally:
        if new_session:
            new_session.close()
    GCM.log('Response    status:    {0}    {1}', response.status_code, response.reason)
    GCM.log('Response    headers:    {0}', response.headers)
    GCM.log('Response    data:    {0}', response.text)
    self.retry_after = get_retry_after(response.headers)
    if (response.status_code == 200):
        if is_json:
            response = response.json()
        else:
            response = response.content
        return response
    if (response.status_code == 400):
        raise GCMMalformedJsonException('The    request    could    not    be    parsed    as    JSON')
    elif (response.status_code == 401):
        raise GCMAuthenticationException('There    was    an    error    authenticating    the    sender    account')
    elif (response.status_code == 503):
        raise GCMUnavailableException('GCM    service    is    unavailable')
    else:
        error = ('GCM    service    error:    %d' % response.status_code)
        raise GCMUnavailableException(error)
