'Return the client from the OAuth parameters.'

def get_client(self, request=None):

    if (not isinstance(request, oauth.Request)):
        request = self.get_oauth_request()
    client_key = request.get_parameter('oauth_consumer_key')
    if (not client_key):
        raise Exception('Missing    "oauth_consumer_key"    parameter    in    OAuth    "Authorization"    header')
    client = models.Client.get_by_key_name(client_key)
    if (not client):
        raise Exception(('Client    "%s"    not    found.' % client_key))
    return client
