import json


def handle_event(ext, body):
    """Handle an event from the queue.

    :param ext: The extension that's handling this event.
    :param body: The body of the event.
    :return: The result of the handler.
    """
    payload = json.loads(body)
    return ext.obj.event(author_id=payload['author_id'] or None,
                         method=payload['method'] or None,
                         url=payload['url'] or None,
                         path=payload['path'] or None,
                         query_string=payload['query_string'] or None,
                         status=payload['status'] or None,
                         resource=payload['resource'] or None,
                         resource_id=payload['resource_id'] or None,
                         sub_resource=payload['sub_resource'] or None,
                         sub_resource_id=payload['sub_resource_id'] or None,
                         resource_before=payload['resource_before'] or None,
                         resource_after=payload['resource_after'] or None)