import pytz


def localize_unlocalized_dt(dt):
    """Turn naive datetime objects into UTC.
    Don't do anything if the datetime object is aware.
    https://docs.python.org/3/library/datetime.html#datetime.timezone
    """
    if dt.tzinfo is not None and dt.tzinfo.utcoffset(dt) is not None:
        return dt
    return pytz.utc.localize(dt)