nodes: 0, module; 1, function_definition; 2, function_name:sorted_timezones; 3, parameters; 4, block; 5, expression_statement; 6, function_definition; 7, expression_statement; 8, comment:# Make a list of country code mappings; 9, expression_statement; 10, for_statement; 11, comment:# Make a list of timezones, discarding the US/* and Canada/* zones since they aren't reliable for; 12, comment:# DST, and discarding UTC and GMT since timezones in that zone have their own names; 13, expression_statement; 14, comment:# Sort timezones by offset from UTC and their human-readable name; 15, expression_statement; 16, expression_statement; 17, comment:# Return a list of (timezone, label) with the timezone offset included in the label.; 18, return_statement; 19, comment:"""
      Return a list of timezones sorted by offset from UTC.
      """; 20, function_name:hourmin; 21, parameters; 22, block; 23, assignment; 24, assignment; 25, identifier:countrycode; 26, attribute; 27, block; 28, assignment; 29, assignment; 30, call; 31, list_comprehension; 32, identifier:delta; 33, if_statement; 34, expression_statement; 35, return_statement; 36, identifier:now; 37, call; 38, identifier:timezone_country; 39, dictionary; 40, identifier:pytz; 41, identifier:country_timezones; 42, for_statement; 43, identifier:timezones; 44, list_comprehension; 45, identifier:presorted; 46, list_comprehension; 47, attribute; 48, argument_list; 49, tuple; 50, for_in_clause; 51, comparison_operator:delta.days < 0; 52, block; 53, else_clause; 54, assignment; 55, expression_list; 56, attribute; 57, argument_list; 58, identifier:timezone; 59, subscript; 60, block; 61, tuple; 62, for_in_clause; 63, if_clause; 64, tuple; 65, for_in_clause; 66, identifier:presorted; 67, identifier:sort; 68, identifier:name; 69, identifier:label; 70, tuple_pattern; 71, identifier:presorted; 72, attribute; 73, integer:0; 74, expression_statement; 75, block; 76, pattern_list; 77, call; 78, identifier:hours; 79, identifier:minutes; 80, identifier:datetime; 81, identifier:utcnow; 82, attribute; 83, identifier:countrycode; 84, expression_statement; 85, call; 86, identifier:tzname; 87, identifier:tzname; 88, attribute; 89, boolean_operator; 90, identifier:delta; 91, binary_operator:'%s%s - %s%s (%s)' % (
          (delta.days < 0 and '-') or (delta.days == 0 and delta.seconds == 0 and ' ') or '+',
          '%02d:%02d' % hourmin(delta),
          (pytz.country_names[timezone_country[name]] + ': ') if name in timezone_country else '',
          name.replace('_', ' '),
          pytz.timezone(name).tzname(now, is_dst=False)); 92, identifier:name; 93, pattern_list; 94, identifier:timezones; 95, identifier:delta; 96, identifier:label; 97, identifier:name; 98, identifier:delta; 99, identifier:days; 100, assignment; 101, expression_statement; 102, identifier:minutes; 103, identifier:remaining; 104, identifier:divmod; 105, argument_list; 106, identifier:pytz; 107, identifier:country_timezones; 108, assignment; 109, attribute; 110, argument_list; 111, identifier:pytz; 112, identifier:common_timezones; 113, boolean_operator; 114, comparison_operator:tzname not in ('GMT', 'UTC'); 115, string; 116, tuple; 117, identifier:delta; 118, identifier:name; 119, pattern_list; 120, call; 121, assignment; 122, identifier:remaining; 123, integer:60; 124, subscript; 125, identifier:countrycode; 126, call; 127, identifier:utcoffset; 128, identifier:now; 129, keyword_argument; 130, not_operator; 131, not_operator; 132, identifier:tzname; 133, tuple; 134, string_content:%s%s - %s%s (%s); 135, boolean_operator; 136, binary_operator:'%02d:%02d' % hourmin(delta); 137, conditional_expression:(pytz.country_names[timezone_country[name]] + ': ') if name in timezone_country else ''; 138, call; 139, call; 140, identifier:hours; 141, identifier:remaining; 142, identifier:divmod; 143, argument_list; 144, pattern_list; 145, call; 146, identifier:timezone_country; 147, identifier:timezone; 148, attribute; 149, argument_list; 150, identifier:is_dst; 151, False; 152, call; 153, call; 154, string; 155, string; 156, boolean_operator; 157, string; 158, string; 159, call; 160, parenthesized_expression; 161, comparison_operator:name in timezone_country; 162, string; 163, attribute; 164, argument_list; 165, attribute; 166, argument_list; 167, binary_operator:86400 - delta.seconds; 168, integer:3600; 169, identifier:hours; 170, identifier:remaining; 171, identifier:divmod; 172, argument_list; 173, identifier:pytz; 174, identifier:timezone; 175, identifier:tzname; 176, attribute; 177, argument_list; 178, attribute; 179, argument_list; 180, string_content:GMT; 181, string_content:UTC; 182, parenthesized_expression; 183, parenthesized_expression; 184, string_content:+; 185, string_content:%02d:%02d; 186, identifier:hourmin; 187, argument_list; 188, binary_operator:pytz.country_names[timezone_country[name]] + ': '; 189, identifier:name; 190, identifier:timezone_country; 191, identifier:name; 192, identifier:replace; 193, string; 194, string; 195, call; 196, identifier:tzname; 197, identifier:now; 198, keyword_argument; 199, integer:86400; 200, attribute; 201, attribute; 202, integer:3600; 203, identifier:tzname; 204, identifier:startswith; 205, string; 206, identifier:tzname; 207, identifier:startswith; 208, string; 209, boolean_operator; 210, boolean_operator; 211, identifier:delta; 212, subscript; 213, string; 214, string_content:_; 215, string_content:; 216, attribute; 217, argument_list; 218, identifier:is_dst; 219, False; 220, identifier:delta; 221, identifier:seconds; 222, identifier:delta; 223, identifier:seconds; 224, string_content:US/; 225, string_content:Canada/; 226, comparison_operator:delta.days < 0; 227, string; 228, boolean_operator; 229, string; 230, attribute; 231, subscript; 232, string_content::; 233, identifier:pytz; 234, identifier:timezone; 235, identifier:name; 236, attribute; 237, integer:0; 238, string_content:-; 239, comparison_operator:delta.days == 0; 240, comparison_operator:delta.seconds == 0; 241, string_content:; 242, identifier:pytz; 243, identifier:country_names; 244, identifier:timezone_country; 245, identifier:name; 246, identifier:delta; 247, identifier:days; 248, attribute; 249, integer:0; 250, attribute; 251, integer:0; 252, identifier:delta; 253, identifier:days; 254, identifier:delta; 255, identifier:seconds
code: def sorted_timezones():
      """
      Return a list of timezones sorted by offset from UTC.
      """
      def hourmin(delta):
          if delta.days < 0:
              hours, remaining = divmod(86400 - delta.seconds, 3600)
          else:
              hours, remaining = divmod(delta.seconds, 3600)
          minutes, remaining = divmod(remaining, 60)
          return hours, minutes
  
      now = datetime.utcnow()
      # Make a list of country code mappings
      timezone_country = {}
      for countrycode in pytz.country_timezones:
          for timezone in pytz.country_timezones[countrycode]:
              timezone_country[timezone] = countrycode
  
      # Make a list of timezones, discarding the US/* and Canada/* zones since they aren't reliable for
      # DST, and discarding UTC and GMT since timezones in that zone have their own names
      timezones = [(pytz.timezone(tzname).utcoffset(now, is_dst=False), tzname) for tzname in pytz.common_timezones
          if not tzname.startswith('US/') and not tzname.startswith('Canada/') and tzname not in ('GMT', 'UTC')]
      # Sort timezones by offset from UTC and their human-readable name
      presorted = [(delta, '%s%s - %s%s (%s)' % (
          (delta.days < 0 and '-') or (delta.days == 0 and delta.seconds == 0 and ' ') or '+',
          '%02d:%02d' % hourmin(delta),
          (pytz.country_names[timezone_country[name]] + ': ') if name in timezone_country else '',
          name.replace('_', ' '),
          pytz.timezone(name).tzname(now, is_dst=False)), name) for delta, name in timezones]
      presorted.sort()
      # Return a list of (timezone, label) with the timezone offset included in the label.
      return [(name, label) for (delta, label, name) in presorted]