def remove_outer_key(event, key_name):
    """ Removes the outer key from an event

    :param event: A dict with the entire event
    :param key_name: The key to remove from the dictionary
    :return: An event with the outer key for the specified dictionary removed

    Examples:

    .. code-block:: python

        # Example #1
        event = {'outer_dict': {'a_field': 'a_value ',
                                'another_field': 'another_value'}}
        event = remove_outer_key(event, key_name='outer_dict')
        event = {'a_field': 'a_value ',
                'another_field': 'another_value'}

    """

    # Removes the metrics key so we don't have every field prefixed with metrics_
    # if key_name in event and event[key_name] is dict:
    if key_name in event and isinstance(event[key_name], dict):
        event.update(event[key_name])
        del event[key_name]

    return event