(utc_dt)
return local_dt.replace(microsecond=utc_dt.microsecond)
:param utc_dt: datetime in UTC
    :return: datetime in the local timezone
:param utc_dt: datetime in UTC
    :return: datetime in the local timezone
: param utc_dt : datetime in UTC : return : datetime in the local timezone
def utc_to_local(utc_dt):
    """
    :param utc_dt: datetime in UTC
    :return: datetime in the local timezone
    """
    # get integer timestamp to avoid precision lost
    timestamp = calendar.timegm(utc_dt.timetuple())
    local_dt = datetime.datetime.fromtimestamp(timestamp)
    assert utc_dt.resolution >= datetime.timedelta(microseconds=1)
    return local_dt.replace(microsecond=utc_dt.microsecond)
def utc_to_local ( utc_dt ) : # get integer timestamp to avoid precision lost timestamp = calendar . timegm ( utc_dt . timetuple ( ) ) local_dt = datetime . datetime . fromtimestamp ( timestamp ) assert utc_dt . resolution >= datetime . timedelta ( microseconds = 1 ) return local_dt . replace ( microsecond = utc_dt . microsecond )