def remove_duplicate_field(event, field_to_keep, field_to_discard):
    """ Remove a field when both fields are present

    :param event:  A dictionary
    :param field_to_keep: The field to keep if both keys are present and the value is not None
    :param field_to_discard: The field to discard if the field_to_keep is not None
    :return: An event with a single bundle ID

    Examples:

    .. code-block:: python

        # Example #1
        event = {'A_Field': 'another_value', 'a_field': 'a_value '}
        event = remove_duplicate_field(event, field_to_keep='a_field', field_to_discard='A_Field')
        event = {'a_field': 'a_value '}

    """

    if field_to_keep in event and field_to_discard in event:
        if event[field_to_keep] is not None:
            del event[field_to_discard]
        else:
            del event[field_to_keep]

    return event