def update_date_filter(date_filter, p1, p2):
    """
    Make sure the filter on a date with param p1 is always the same as param p2 if p2 is
    not provided.

    Example:

        new_filter = update_date_filter(
            {
                'BeginCreationDate': datetime.datetime(2019, 9, 6)},
                'BeginCreationDate', 'BeginModificationDate'
            )

        new_filter is:
            {
                'BeginCreationDate': datetime.datetime(2019, 9, 6),
                'BeginModificationDate': datetime.datetime(2019, 9, 6),
            }

    """
    # If the first parameter is not in the filter, we just return the original filter
    if p1 not in date_filter:
        return date_filter

    new_date_filter = date_filter.copy()
    if p1 in date_filter and p2 not in new_date_filter:
        new_date_filter.update({p2: new_date_filter[p1]})
    return new_date_filter