def parse_timezone(text):
 if (not (text[0] in '+-')):
  raise ValueError(('Timezone must start with + or - (%(text)s)' % vars()))
 sign = text[:1]
 offset = int(text[1:])
 if (sign == '-'):
  offset = (- offset)
 unnecessary_negative_timezone = ((offset >= 0) and (sign == '-'))
 signum = (((offset < 0) and (-1)) or 1)
 offset = abs(offset)
 hours = int((offset / 100))
 minutes = (offset % 100)
 return ((signum * ((hours * 3600) + (minutes * 60))), unnecessary_negative_timezone)

def parse_timezone ( text ) : if ( not ( text [ 0 ] in '+-' ) ) : raise ValueError ( ( 'Timezone must start with + or - (%(text)s)' % vars ( ) ) ) sign = text [ : 1 ] offset = int ( text [ 1 : ] ) if ( sign == '-' ) : offset = ( - offset ) unnecessary_negative_timezone = ( ( offset >= 0 ) and ( sign == '-' ) ) signum = ( ( ( offset < 0 ) and ( - 1 ) ) or 1 ) offset = abs ( offset ) hours = int ( ( offset / 100 ) ) minutes = ( offset % 100 ) return ( ( signum * ( ( hours * 3600 ) + ( minutes * 60 ) ) ) , unnecessary_negative_timezone )
parses iso 8601 time zone specs into tzinfo offsets .