def METHOD_NAME():
    """Returns a function that converts a datetime or date into the date that would be
    returned by the widget."""
    def normalize_date(value):
        if isinstance(value, datetime):
            return value.date()
        elif isinstance(value, date):
            return value
        else:
            raise TypeError(value)
    return normalize_date