def validate_timezone(zone):
 if (zone is None):
  return None
 if (not pytz):
  if (zone.upper() != u'UTC'):
   raise ValueError(u'Only UTC available, since pytz is not installed.')
  else:
   return zone
 zone = u'/'.join(reversed(zone.split(u', '))).replace(u' ', u'_')
 if (len(zone) <= 4):
  zone = zone.upper()
 else:
  zone = zone.title()
 if (zone in pytz.all_timezones):
  return zone
 else:
  raise ValueError(u'Invalid time zone.')

def validate_timezone ( zone ) : if ( zone is None ) : return None if ( not pytz ) : if ( zone . upper ( ) != u'UTC' ) : raise ValueError ( u'Only UTC available, since pytz is not installed.' ) else : return zone zone = u'/' . join ( reversed ( zone . split ( u', ' ) ) ) . replace ( u' ' , u'_' ) if ( len ( zone ) <= 4 ) : zone = zone . upper ( ) else : zone = zone . title ( ) if ( zone in pytz . all_timezones ) : return zone else : raise ValueError ( u'Invalid time zone.' )
return an ietf timezone from the given ietf zone or common abbreviation .