def get_timezone(db=None, config=None, zone=None, nick=None, channel=None):
 def _check(zone):
  try:
   return validate_timezone(zone)
  except ValueError:
   return None
 if (not pytz):
  return None
 tz = None
 if zone:
  tz = _check(zone)
  if (not tz):
   tz = _check(db.get_nick_or_channel_value(zone, u'timezone'))
 if ((not tz) and nick):
  tz = _check(db.get_nick_value(nick, u'timezone'))
 if ((not tz) and channel):
  tz = _check(db.get_channel_value(channel, u'timezone'))
 if ((not tz) and config and config.core.default_timezone):
  tz = _check(config.core.default_timezone)
 return tz

def get_timezone ( db = None , config = None , zone = None , nick = None , channel = None ) : def _check ( zone ) : try : return validate_timezone ( zone ) except ValueError : return None if ( not pytz ) : return None tz = None if zone : tz = _check ( zone ) if ( not tz ) : tz = _check ( db . get_nick_or_channel_value ( zone , u'timezone' ) ) if ( ( not tz ) and nick ) : tz = _check ( db . get_nick_value ( nick , u'timezone' ) ) if ( ( not tz ) and channel ) : tz = _check ( db . get_channel_value ( channel , u'timezone' ) ) if ( ( not tz ) and config and config . core . default_timezone ) : tz = _check ( config . core . default_timezone ) return tz
looks up a timezone by name and returns it .