code: def _http(method, url, headers=None, **kw):
      '''
      Send http request and return response text.
      '''
      params = None
      boundary = None
      if method == 'UPLOAD':
          params, boundary = _encode_multipart(**kw)
      else:
          params = _encode_params(**kw)
      http_url = '%s?%s' % (url, params) if method == _HTTP_GET else url
      http_body = None if method == 'GET' else params
      logging.error('%s: %s' % (method, http_url))
      req = urllib2.Request(http_url, data=http_body)
      req.add_header('Accept-Encoding', 'gzip')
      if headers:
          for k, v in headers.iteritems():
              req.add_header(k, v)
      if boundary:
          req.add_header('Content-Type', 'multipart/form-data; boundary=%s' % boundary)
      try:
          resp = urllib2.urlopen(req, timeout=5)
          return _read_http_body(resp)
      finally:
          pasf _http(method, url, headers=None, **kw):
      '''
      Send http request and return response text.
      '''
      params = None
      boundary = None
      if method == 'UPLOAD':
          params, boundary = _encode_multipart(**kw)
      else:
          params = _encode_params(**kw)
      http_url = '%s?%s' % (url, params) if method == _HTTP_GET else url
      http_body = None if method == 'GET' else params
      logging.error('%s: %s' % (method, http_url))
      req = urllib2.Request(http_url, data=http_body)
      req.add_header('Accept-Encoding', 'gzip')
      if headers:
          for k, v in headers.iteritems():
              req.add_header(k, v)
      if boundary:
          req.add_header('Content-Type', 'multipart/form-data; boundary=%s' % boundary)
      try:
          resp = urllib2.urlopen(req, timeout=5)
          return _read_http_body(resp)
      finally:
          pass
docs: Send http request and return response text.