nodes: 0, module; 1, function_definition; 2, function_name:_priority_key; 3, parameters; 4, block; 5, identifier:pep8_result; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, try_statement; 12, comment:"""Key for sorting PEP8 results.
  
      Global fixes should be done first. This is important for things like
      indentation.
  
      """; 13, assignment; 14, assignment; 15, assignment; 16, assignment; 17, block; 18, except_clause; 19, identifier:priority; 20, list; 21, identifier:middle_index; 22, integer:10000; 23, identifier:lowest_priority; 24, list; 25, identifier:key; 26, call; 27, return_statement; 28, identifier:ValueError; 29, block; 30, comment:# Fix multiline colon-based before semicolon based.; 31, string; 32, comment:# Break multiline statements early.; 33, string; 34, comment:# Things that make lines longer.; 35, string; 36, string; 37, comment:# Remove extraneous whitespace before breaking lines.; 38, string; 39, comment:# Shorten whitespace in comment before resorting to wrapping.; 40, string; 41, comment:# We need to shorten lines last since the logical fixer can get in a; 42, comment:# loop, which causes us to exit early.; 43, string; 44, attribute; 45, argument_list; 46, call; 47, try_statement; 48, string_content:e701; 49, string_content:e702; 50, string_content:e225; 51, string_content:e231; 52, string_content:e201; 53, string_content:e262; 54, string_content:e501; 55, subscript; 56, identifier:lower; 57, attribute; 58, argument_list; 59, block; 60, except_clause; 61, identifier:pep8_result; 62, string; 63, identifier:priority; 64, identifier:index; 65, identifier:key; 66, return_statement; 67, identifier:ValueError; 68, block; 69, string_content:id; 70, binary_operator:middle_index + lowest_priority.index(key) + 1; 71, return_statement; 72, binary_operator:middle_index + lowest_priority.index(key); 73, integer:1; 74, identifier:middle_index; 75, identifier:middle_index; 76, call; 77, attribute; 78, argument_list; 79, identifier:lowest_priority; 80, identifier:index; 81, identifier:key
code: def _priority_key(pep8_result):
      """Key for sorting PEP8 results.
  
      Global fixes should be done first. This is important for things like
      indentation.
  
      """
      priority = [
          # Fix multiline colon-based before semicolon based.
          'e701',
          # Break multiline statements early.
          'e702',
          # Things that make lines longer.
          'e225', 'e231',
          # Remove extraneous whitespace before breaking lines.
          'e201',
          # Shorten whitespace in comment before resorting to wrapping.
          'e262'
      ]
      middle_index = 10000
      lowest_priority = [
          # We need to shorten lines last since the logical fixer can get in a
          # loop, which causes us to exit early.
          'e501'
      ]
      key = pep8_result['id'].lower()
      try:
          return priority.index(key)
      except ValueError:
          try:
              return middle_index + lowest_priority.index(key) + 1
          except ValueError:
              return middle_index