def get_event_abi(abi, event_name):
    """Helper function that extracts the event abi from the given abi.

    Args:
        abi (list): the contract abi
        event_name (str): the event name

    Returns:
        dict: the event specific abi
    """
    for entry in abi:
        if 'name' in entry.keys() and entry['name'] == event_name and entry[
            'type'] == 'event':
            return entry
    raise ValueError('Event `{0}` not found in the contract abi'.format(
        event_name))
