If tzid is of the form [+-]hh:mm, we rewrite it to GMT[+-]hh:mm
Otherwise return it unchanged.
544649
static String cleanUpTzid(String tzid) {
        Matcher m = HOUR_MINUTE.matcher(tzid);
        return m.matches() ?  // of the form [+-]hh:mm
                "GMT" +
                        (tzid.startsWith("-") || tzid.startsWith("+") ? "" : "+") + tzid :
                tzid;
    }
70763
def to_naive(self, dt):
        """"""
        if dt.tzinfo is None:
            return dt
        return dt.astimezone(self.utc).replace(tzinfo=None)
329328
def convert_2_utc(self, datetime_, timezone):
        """"""

        datetime_ = self.tz_mapper[timezone].localize(datetime_)
        return datetime_.astimezone(pytz.UTC)
774926
def to_pydatetime(self):
        
        dt = datetime.datetime.combine(self._date.to_pydate(), self._time.to_pytime())
        from .tz import FixedOffsetTimezone
        return dt.replace(tzinfo=_utc).astimezone(FixedOffsetTimezone(self._offset))
8990
function untgz(istream, dst){
    // decompress
    const tarStream = istream.pipe(_zlib.createGunzip());

    // unpack
    return _untar(tarStream, dst);
}
1338363
def astimezone(self, tzinfo):
    
    # Assert we are not a naive datetime object
    assert self.tzinfo is not None

    tzinfo = _tzinfome(tzinfo)

    d = self.asdatetime(naive=False).astimezone(tzinfo)
    return type(self)(d)
1314438
def isotime(at=None, subsecond=False):
    """"""
    if not at:
        at = utcnow()
    st = at.strftime(_ISO8601_TIME_FORMAT
                     if not subsecond
                     else _ISO8601_TIME_FORMAT_SUBSECOND)
    tz = at.tzinfo.tzname(None) if at.tzinfo else 'UTC'
    st += ('Z' if tz == 'UTC' else tz)
    return st
491273
function( text ) {
			if(modules.utils.isString(text)){
				text = text.toLowerCase();
				text = modules.utils.trim( text );
				// start with timezone char
				if( text.match(':') && ( modules.utils.startWith(text, 'z') || modules.utils.startWith(text, '-')  || modules.utils.startWith(text, '+') )) {
					return true;
				}
				// has ante meridiem or post meridiem
				if( text.match(/^[0-9]/) &&
					( this.hasAM(text) || this.hasPM(text) )) {
					return true;
				}
				// contains time delimiter but not datetime delimiter
				if( text.match(':') && !text.match(/t|\s/) ) {
					return true;
				}

				// if it's a number of 2, 4 or 6 chars
				if(modules.utils.isNumber(text)){
					if(text.length === 2 || text.length === 4 || text.length === 6){
						return true;
					}
				}
			}
			return false;
		}
316192
def GetTZInfo(tzname='UTC', utcOffset=None, dst=None):
      
      key = (tzname, utcOffset, dst)
      tzInfo = TZManager._tzInfos.get(key)
      if not tzInfo:
         tzInfo = TZInfo(tzname, utcOffset, dst)
         TZManager._tzInfos[key] = tzInfo
      return tzInfo
1350203
def parse_z(cls, offset):
        
        assert len(offset) == 5, 'Invalid offset string format, must be "+HHMM"'
        return timedelta(hours=int(offset[:3]), minutes=int(offset[0] + offset[3:]))
1157907
void formatTimeZone_X(StringBuilder b, ZonedDateTime d, int width, char ch) {
    int[] tz = getTzComponents(d);
    
    // Emit a 'Z' by itself for X if time is exactly GMT
    if (ch == 'X' && tz[TZOFFSET] == 0) {
      b.append('Z');
      return;
    }

    switch (width) {
      case 5:
      case 4:
      case 3:
      case 2:
      case 1:
        if (tz[TZNEG] == -1) {
          b.append('-');
        } else {
          b.append('+');
        }

        zeroPad2(b, tz[TZHOURS], 2);
        
        // Delimiter is omitted for X, XX and XXXX
        if (width == 3 || width == 5) {
          b.append(':');
        }
        int mins = tz[TZMINS];

        // Minutes are optional for X
        if (width != 1 || mins > 0) {
          zeroPad2(b, mins, 2);
        }
        break;
    }
  }
996980
def datetime_to_timezone(date, tz="UTC"):
    
    if not date.tzinfo:
        date = date.replace(tzinfo=timezone(get_timezone()))
    return date.astimezone(timezone(tz))
1326008
def remove_parenthesis_around_tz(cls, timestr):
        
        parenthesis = cls.TIMEZONE_PARENTHESIS.match(timestr)
        if parenthesis is not None:
            return parenthesis.group(1)
1007761
def format_as_utc(self, value):
        """"""
        if isinstance(value, datetime.datetime):
            if value.tzinfo is not None:
                value = value.astimezone(pytz.UTC)
            value = value.replace(microsecond=0)
        return value.isoformat().replace('+00:00', 'Z')
81651
def ewsformat(self):
        
        if not self.tzinfo:
            raise ValueError('EWSDateTime must be timezone-aware')
        if self.tzinfo.zone == 'UTC':
            return self.strftime('%Y-%m-%dT%H:%M:%SZ')
        return self.replace(microsecond=0).isoformat()
800749
def localize(dt):
    """"""
    if dt.tzinfo is UTC:
        return (dt + LOCAL_UTC_OFFSET).replace(tzinfo=None)
    # No TZ info so not going to assume anything, return as-is.
    return dt
538572
def convert_to_utc(time):
        

        # time is already in UTC
        if 'Z' in time:
            return time
        else:
            time_formatted = time[:-3] + time[-2:]
            dt = datetime.strptime(time_formatted, '%Y-%m-%dT%H:%M:%S%z')
            dt = dt.astimezone(timezone('UTC'))
            return dt.strftime('%Y-%m-%dT%H:%M:%SZ')