'Add OAuth parameters to the request.
Parameters may be included from the body if the content-type is
urlencoded, if no content type is set an educated guess is made.'

def __call__(self, r):

    contenttype = r.headers.get('Content-Type', '').split(';')[0].lower()
    decoded_body = extract_params(r.data)
    _oauth_signed = True
    if (r.files and (contenttype == CONTENT_TYPE_MULTI_PART)):
        (r.url, r.headers, _) = self.client.sign(unicode(r.full_url), unicode(r.method), None, r.headers)
    elif ((decoded_body is not None) and (contenttype in (CONTENT_TYPE_FORM_URLENCODED, ''))):
        if (not contenttype):
            r.headers['Content-Type'] = CONTENT_TYPE_FORM_URLENCODED
        (r.url, r.headers, r.data) = self.client.sign(unicode(r.full_url), unicode(r.method), r.data, r.headers)
    else:
        _oauth_signed = False
    if _oauth_signed:
        r.params = {}
        u_header = unicode('Authorization')
        if (u_header in r.headers):
            auth_header = r.headers[u_header].encode('utf-8')
            del r.headers[u_header]
            r.headers['Authorization'] = auth_header
    return r
