Read the zoneinfo structure for a given timezone name.

        :param timezone: The timezone.
328603
def read_for(self, timezone):  # type: (str) -> Timezone
        
        try:
            file_path = pytzdata.tz_path(timezone)
        except TimezoneNotFound:
            raise InvalidTimezone(timezone)

        return self.read(file_path)
156573
def to_timezone(dt, tzinfo=None):
    
    if not dt:
        return dt
    tz = pick_timezone(tzinfo, __timezone__)
    if not tz:
        return dt
    dttz = getattr(dt, 'tzinfo', None)
    if not dttz:
        return dt.replace(tzinfo=tz)
    else:
        return dt.astimezone(tz)
937394
def strtimezone ():
    
    if time.daylight:
        zone = time.altzone
    else:
        zone = time.timezone
    return "%+04d" % (-zone//SECONDS_PER_HOUR)
728899
def utc_minute_timezone(self, minutes_from_utc):
        """"""
        from_zone = tz.gettz('UTC')
        to_zone = self.location.timezone
        utc = dt.datetime.combine(self.date, dt.time()) + \
            dt.timedelta(minutes=minutes_from_utc)
        utc = utc.replace(tzinfo=from_zone)
        local = utc.astimezone(to_zone)
        return local
270655
def _build_date_time_time_zone(self, date_time):
        
        timezone = date_time.tzinfo.zone if date_time.tzinfo is not None else None
        return {
            self._cc('dateTime'): date_time.strftime('%Y-%m-%dT%H:%M:%S'),
            self._cc('timeZone'): get_windows_tz(timezone or self.protocol.timezone)
        }
880972
def set_timezone(data, tz=None, from_local=False):
    
    # pandas object?
    if isinstance(data, pd.DataFrame) | isinstance(data, pd.Series):
        try:
            try:
                data.index = data.index.tz_convert(tz)
            except Exception as e:
                if from_local:
                    data.index = data.index.tz_localize(
                        get_timezone()).tz_convert(tz)
                else:
                    data.index = data.index.tz_localize('UTC').tz_convert(tz)
        except Exception as e:
            pass

    # not pandas...
    else:
        if isinstance(data, str):
            data = parse_date(data)
        try:
            try:
                data = data.astimezone(tz)
            except Exception as e:
                data = timezone('UTC').localize(data).astimezone(timezone(tz))
        except Exception as e:
            pass

    return data
613833
def get_timezone() -> Tuple[datetime.tzinfo, str]:
    """"""
    dt = get_datetime_now().astimezone()
    tzstr = dt.strftime("%z")
    tzstr = tzstr[:-2] + ":" + tzstr[-2:]
    return dt.tzinfo, tzstr
574430
public Name getTimeZoneName(String zoneId, ZonedDateTime date, boolean long_) {
    TimeZoneNames names = timezoneNames.get(zoneId);
    if (names != null) {
      return long_ ? names.longName() : names.shortName();
    }
    
    zoneId = _CalendarUtils.getMetazone(zoneId, date);
    if (zoneId == null) {
      return null;
    }
    names = metazoneNames.get(zoneId);
    if (names != null) {
      return long_ ? names.longName() : names.shortName();
    }
    return null;
  }
1066669
def _get_tz(tz):
    
    zone = timezones.get_timezone(tz)
    if zone is None:
        zone = tz.utcoffset().total_seconds()
    return zone
1004264
def read(self, file_path):  # type: (str) -> Timezone
        
        if not os.path.exists(file_path):
            raise InvalidZoneinfoFile("The tzinfo file does not exist")

        with open(file_path, "rb") as fd:
            return self._parse(fd)
1263304
def convert_timezone(date_str, tz_from, tz_to="UTC", fmt=None):
    
    tz_offset = datetime_to_timezone(
        datetime.datetime.now(), tz=tz_from).strftime('%z')
    tz_offset = tz_offset[:3] + ':' + tz_offset[3:]

    date = parse_date(str(date_str) + tz_offset)
    if tz_from != tz_to:
        date = datetime_to_timezone(date, tz_to)

    if isinstance(fmt, str):
        return date.strftime(fmt)
    return date
642806
def timeInfo(self):
        """"""
        time_info = self._json_struct.get('timeInfo', {})
        if not time_info:
            return None
        time_info = time_info.copy()
        if 'timeExtent' in time_info:
            time_info['timeExtent'] = utils.timetopythonvalue(
                                                    time_info['timeExtent'])
        return time_info
115836
def _get_timezone(self, root):
        """"""
        tz_str = root.xpath('//div[@class="smallfont" and @align="center"]')[0].text
        hours = int(self._tz_re.search(tz_str).group(1))
        return tzoffset(tz_str, hours * 60)
650381
def _tzinfome(tzinfo):
  
  if not isinstance(tzinfo, datetime.tzinfo):
    try:
      tzinfo = pytz.timezone(tzinfo)
      assert tzinfo.zone in pytz.all_timezones
    except AttributeError:
      raise pytz.UnknownTimeZoneError("Unknown timezone! %s" % tzinfo)
  return tzinfo
1077142
def get_zone(self, zone_name):
        
        for zone in self.get_zones():
            if zone_name == zone['name']:
                return zone

        raise RuntimeError("Unknown zone")
1219153
def _ParseTimezoneOption(self, options):
    
    time_zone_string = self.ParseStringOption(options, 'timezone')
    if isinstance(time_zone_string, py2to3.STRING_TYPES):
      if time_zone_string.lower() == 'list':
        self.list_timezones = True

      elif time_zone_string:
        try:
          pytz.timezone(time_zone_string)
        except pytz.UnknownTimeZoneError:
          raise errors.BadConfigOption(
              'Unknown time zone: {0:s}'.format(time_zone_string))

        self._preferred_time_zone = time_zone_string
462339
def timezone(self):
        
        date = self.message.get('date')
        timezone = 0

        try:
            _, timezone = convert_mail_date(date)
        finally:
            return timezone