Create an API request.

    `request_type` is the request type (string). This is used to look up a
    plugin, whose request class is instantiated and passed the remaining
    arguments passed to this function.

def api_request(request, *args, **kwargs):
    """
    Create an API request.

    `request_type` is the request type (string). This is used to look up a
    plugin, whose request class is instantiated and passed the remaining
    arguments passed to this function.
    """
    plugin = pm.api_plugin_for_request(request)
    if plugin and plugin.request_class:
        req = plugin.request_class(*args, **kwargs)
    else:
        raise Exception("Invalid request type")
    return req