code: 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)
docs: :param utc_dt: datetime in UTC
      :return: datetime in the local timezone