nodes: 0, module; 1, function_definition; 2, function_name:get_sorted_fields; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, return_statement; 11, comment:"""Return the sorted fields
          """; 12, assignment; 13, assignment; 14, function_name:field_cmp; 15, parameters; 16, block; 17, call; 18, identifier:inf; 19, call; 20, identifier:order; 21, call; 22, identifier:field1; 23, identifier:field2; 24, expression_statement; 25, expression_statement; 26, expression_statement; 27, expression_statement; 28, return_statement; 29, identifier:sorted; 30, argument_list; 31, identifier:float; 32, argument_list; 33, attribute; 34, argument_list; 35, assignment; 36, assignment; 37, assignment; 38, assignment; 39, call; 40, call; 41, keyword_argument; 42, string:"inf"; 43, identifier:self; 44, identifier:get_field_order; 45, identifier:_n1; 46, call; 47, identifier:_n2; 48, call; 49, identifier:_i1; 50, boolean_operator; 51, identifier:_i2; 52, boolean_operator; 53, identifier:cmp; 54, argument_list; 55, attribute; 56, argument_list; 57, identifier:cmp; 58, identifier:field_cmp; 59, attribute; 60, argument_list; 61, attribute; 62, argument_list; 63, boolean_operator; 64, identifier:inf; 65, boolean_operator; 66, identifier:inf; 67, identifier:_i1; 68, identifier:_i2; 69, identifier:self; 70, identifier:get_fields; 71, identifier:field1; 72, identifier:getName; 73, identifier:field2; 74, identifier:getName; 75, comparison_operator:_n1 in order; 76, binary_operator:order.index(_n1) + 1; 77, comparison_operator:_n2 in order; 78, binary_operator:order.index(_n2) + 1; 79, identifier:_n1; 80, identifier:order; 81, call; 82, integer:1; 83, identifier:_n2; 84, identifier:order; 85, call; 86, integer:1; 87, attribute; 88, argument_list; 89, attribute; 90, argument_list; 91, identifier:order; 92, identifier:index; 93, identifier:_n1; 94, identifier:order; 95, identifier:index; 96, identifier:_n2
code: def get_sorted_fields(self):
          """Return the sorted fields
          """
          inf = float("inf")
          order = self.get_field_order()
  
          def field_cmp(field1, field2):
              _n1 = field1.getName()
              _n2 = field2.getName()
              _i1 = _n1 in order and order.index(_n1) + 1 or inf
              _i2 = _n2 in order and order.index(_n2) + 1 or inf
              return cmp(_i1, _i2)
  
          return sorted(self.get_fields(), cmp=field_cmp)