def _get_normalized_cfdate(date, calendar, normalize):
    """convert to cf datetime and round down to midnight if normalize."""
    if date is None:
        return date

    cf_date = to_cftime_datetime(date, calendar)

    return normalize_date(cf_date) if normalize else cf_date
convert to cf datetime and round down to midnight if normalize.
xarray/coding/cftime_offsets.py