nodes: 0, module; 1, function_definition; 2, function_name:metadata_sorter; 3, parameters; 4, block; 5, identifier:x; 6, identifier:y; 7, expression_statement; 8, if_statement; 9, if_statement; 10, comment:""" Sort metadata keys by priority.
      """; 11, comparison_operator:x == y; 12, block; 13, boolean_operator; 14, block; 15, elif_clause; 16, elif_clause; 17, else_clause; 18, identifier:x; 19, identifier:y; 20, return_statement; 21, comparison_operator:x in METADATA_SORTER_FIRST; 22, comparison_operator:y in METADATA_SORTER_FIRST; 23, return_statement; 24, comparison_operator:x in METADATA_SORTER_FIRST; 25, block; 26, comparison_operator:y in METADATA_SORTER_FIRST; 27, block; 28, block; 29, integer:0; 30, identifier:x; 31, identifier:METADATA_SORTER_FIRST; 32, identifier:y; 33, identifier:METADATA_SORTER_FIRST; 34, conditional_expression:-1 if METADATA_SORTER_FIRST.index(x) < METADATA_SORTER_FIRST.index(y) else 1; 35, identifier:x; 36, identifier:METADATA_SORTER_FIRST; 37, return_statement; 38, identifier:y; 39, identifier:METADATA_SORTER_FIRST; 40, return_statement; 41, if_statement; 42, unary_operator; 43, comparison_operator:METADATA_SORTER_FIRST.index(x) < METADATA_SORTER_FIRST.index(y); 44, integer:1; 45, unary_operator; 46, integer:1; 47, boolean_operator; 48, block; 49, elif_clause; 50, elif_clause; 51, else_clause; 52, integer:1; 53, call; 54, call; 55, integer:1; 56, call; 57, call; 58, return_statement; 59, call; 60, block; 61, call; 62, block; 63, block; 64, attribute; 65, argument_list; 66, attribute; 67, argument_list; 68, attribute; 69, argument_list; 70, attribute; 71, argument_list; 72, call; 73, attribute; 74, argument_list; 75, return_statement; 76, attribute; 77, argument_list; 78, return_statement; 79, return_statement; 80, identifier:METADATA_SORTER_FIRST; 81, identifier:index; 82, identifier:x; 83, identifier:METADATA_SORTER_FIRST; 84, identifier:index; 85, identifier:y; 86, identifier:x; 87, identifier:startswith; 88, string; 89, identifier:y; 90, identifier:startswith; 91, string; 92, identifier:cmp; 93, argument_list; 94, identifier:x; 95, identifier:startswith; 96, string; 97, integer:1; 98, identifier:y; 99, identifier:startswith; 100, string; 101, unary_operator; 102, call; 103, string_content:_; 104, string_content:_; 105, subscript; 106, subscript; 107, string_content:_; 108, string_content:_; 109, integer:1; 110, identifier:cmp; 111, argument_list; 112, identifier:x; 113, slice; 114, identifier:y; 115, slice; 116, identifier:x; 117, identifier:y; 118, integer:1; 119, integer:1
code: def metadata_sorter(x, y):
      """ Sort metadata keys by priority.
      """
      if x == y:
          return 0
      if x in METADATA_SORTER_FIRST and y in METADATA_SORTER_FIRST:
          return -1 if METADATA_SORTER_FIRST.index(x) < METADATA_SORTER_FIRST.index(y) else 1
      elif x in METADATA_SORTER_FIRST:
          return -1
      elif y in METADATA_SORTER_FIRST:
          return 1
      else:
          if x.startswith('_') and y.startswith('_'):
              return cmp(x[1:], y[1:])
          elif x.startswith('_'):
              return 1
          elif y.startswith('_'):
              return -1
          else:
              return cmp(x, y)