def request(method, url, body=None, headers=None,
            literal=False, use_protected=False,
            timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
    '''\
    A function to issue HTTP requests.

    :param method: the `HTTP method`_ for this request. Case
      insensitive.

    :param url: the URL to request. Must include a protocol
      (e.g. `http`, `https`).

    :param body: the body of the request, if applicable

    :type body: a string or file-like object (i.e, an object that has
      a ``read`` method).  It could also be a dict, in which case
      it is stringified, and the header set to application/json

    :param headers: A dictionary of request headers

    :type headers: :py:class:`dict`

    :param literal: if true, instruct
      :py:class:`~httplib.HTTPConnection` **not** to set the ``Host`` or
      ``Accept-Encoding`` headers automatically.  Useful for testing

    :param use_protected: if true, use the appropriate protected for
      this call.

    :param timeout: connection timeout for this request.

    :returns: a :py:class:`Response` object.

    An example, calling up google with a custom host header:

    >>> request('get',
    ...         'http://google.com',
    ...         headers={'Host': 'www.google.com'},
    ...         literal=True)
    <http_client.Response (200) GET http://google.com>

    .. _HTTP Method: http://en.wikipedia.org/wiki/\
    Hypertext_Transfer_Protocol#Request_methods

    '''
    method = method.upper()
    if method not in _HTTP_METHODS:
        raise ValueError("invalid http method {0}".format(method))

    parsed = urlparse(url)
    if parsed.scheme not in ('http', 'https'):
        raise ValueError('unknown protocol %s' % parsed.scheme)
    domain, _, port = parsed.netloc.partition(':')
    try:
        port = int(port)
    except ValueError:
        port = 80 if parsed.scheme == 'http' else 443

    protected = (parsed.scheme == 'https') and (True if use_protected
                                                else "PLAIN_SSL")
    conn = _GHTTPConnection(domain, port, protected=protected, timeout=timeout)

    selector = urlunparse(parsed._replace(scheme='', netloc=''))

    skips = {'skip_host': True,
             'skip_accept_encoding': True} if literal else {}

    if headers is None:
        headers = {}

    if not literal:
        headers.setdefault('User-Agent', 'python')

    if isinstance(body, dict):
        body = json.dumps(body)
        if 'Content-Type' not in headers:
            headers['Content-Type'] = 'application/json'
    conn.putrequest(method, selector, **skips)
    # OMD!
    if not literal and body is not None and headers not in 'Content-Length':
        conn._set_content_length(body)

    for header, value in headers.items():
        if type(value) is list:
            for subvalue in value:
                conn.putheader(header, subvalue)
        else:
            conn.putheader(header, value)

    conn.endheaders()

    if body is not None:
        conn.send(body)
    raw = conn.getresponse()    # does NOT hold a reference to the
                                # HTTPConnection
    raw._connection = conn      # so the finalizer doesn't get called
                                # until the request has died
    return Response(
        Request(method, url, headers, body),
        raw.status, raw.msg, raw)
dataset/ETHPy150Open paypal/support/support/http_client.py/request/swapped operands of `not in`