(dt, default_tz=UTC)
return dt
Ensures that the returned datetime object is not naive.
Ensures that the returned datetime object is not naive.
Ensures that the returned datetime object is not naive .
def ensure_aware_datetime(dt, default_tz=UTC):
    """
    Ensures that the returned datetime object is not naive.
    """
    if dt.tzinfo is None:
        dt = dt.replace(tzinfo=default_tz)

    return dt
def ensure_aware_datetime ( dt , default_tz = UTC ) : if dt . tzinfo is None : dt = dt . replace ( tzinfo = default_tz ) return dt