def as_utc(dattim: dt.datetime) -> dt.datetime:
    'Return a datetime as UTC time.\n\n    Assumes datetime without tzinfo to be in the DEFAULT_TIME_ZONE.\n    '
    if (dattim.tzinfo == UTC):
        return dattim
    if (dattim.tzinfo is None):
        dattim = DEFAULT_TIME_ZONE.localize(dattim)
    return dattim.astimezone(UTC)
Return a datetime as UTC time.

Assumes datetime without tzinfo to be in the DEFAULT_TIME_ZONE.
def as_utc(dattim: dt.datetime) -> dt.datetime:
    'Return a datetime as UTC time.\n\n    Assumes datetime without tzinfo to be in the DEFAULT_TIME_ZONE.\n    '
    if (dattim.tzinfo == UTC):
        return dattim
    if (dattim.tzinfo is None):
        dattim = DEFAULT_TIME_ZONE.localize(dattim)
    return dattim.astimezone(UTC)