Maintains the existing api for Session.request.
    Used by all of the higher level methods, e.g. Session.get.
    The background_callback param allows you to do some processing on the
    response in the background, e.g. call resp.json() so that json parsing
    happens in the background thread.

def request_patch(self, *args, **kwargs):
    """Maintains the existing api for Session.request.
    Used by all of the higher level methods, e.g. Session.get.
    The background_callback param allows you to do some processing on the
    response in the background, e.g. call resp.json() so that json parsing
    happens in the background thread.
    """
    func = sup = super(FuturesSession, self).request

    background_callback = kwargs.pop('background_callback', None)
    if background_callback:
        def wrap(*args_, **kwargs_):
            resp = sup(*args_, **kwargs_)
            # Patch the closure to return the callback.
            return background_callback(self, resp)

        func = wrap
    return self.executor.submit(func, *args, **kwargs)