def _http_request(session, path, method='GET', options=None, params=None,
    headers=None):
    """Raw HTTP request helper function.

    Keyword arguments:
    :param session: The requests Session object to call a request with.
    :param path: the URL path.
    :param method: the HTTP method.
    :param options: a dictionary of data and parameters to pass on to the request.
    :param params: URL query parameters.
    :param headers: Dictionary of HTTP headers to include in the request.
    :return: requests response object.

    """
    path = path.strip('/')
    path = path.strip()
    url = '{}/{}'.format(session.hostname, path)
    allow_redirects = True
    if method in ['POST', 'PUT']:
        allow_redirects = False
    if options and 'allow_redirects' in options:
        allow_redirects = options['allow_redirects']
    data = None
    if options and 'data' in options:
        data = options['data']
    json = None
    if options and 'json' in options:
        json = options['json']
    if headers is None:
        headers = {}
    response = session.request(method, url, headers=headers,
        allow_redirects=allow_redirects, data=data, json=json, params=params)
    redirect_codes = [300, 301, 302, 303, 304, 305, 306, 307, 308]
    if method in ['POST', 'PUT'] and response.status_code in redirect_codes:
        if response.headers['Location']:
            response = session.request(method, response.headers['Location'],
                headers=headers, allow_redirects=True, data=data, json=json,
                params=params)
    return response
