nodes: 0, module; 1, function_definition; 2, function_name:sort_nts; 3, parameters; 4, block; 5, identifier:self; 6, identifier:nt_list; 7, identifier:codekey; 8, expression_statement; 9, comment:# Problem is that some members in the nt_list do NOT have; 10, comment:# codekey=EvidenceCode, then it returns None, which breaks py34 and 35; 11, comment:# The fix here is that for these members, default to -1 (is this valid?); 12, expression_statement; 13, return_statement; 14, comment:"""Sort list of namedtuples such so evidence codes in same order as code2nt."""; 15, assignment; 16, call; 17, identifier:sortby; 18, lambda; 19, identifier:sorted; 20, argument_list; 21, lambda_parameters; 22, call; 23, identifier:nt_list; 24, keyword_argument; 25, identifier:nt; 26, attribute; 27, argument_list; 28, identifier:key; 29, identifier:sortby; 30, attribute; 31, identifier:get; 32, call; 33, unary_operator; 34, identifier:self; 35, identifier:ev2idx; 36, identifier:getattr; 37, argument_list; 38, integer:1; 39, identifier:nt; 40, identifier:codekey
code: def sort_nts(self, nt_list, codekey):
          """Sort list of namedtuples such so evidence codes in same order as code2nt."""
          # Problem is that some members in the nt_list do NOT have
          # codekey=EvidenceCode, then it returns None, which breaks py34 and 35
          # The fix here is that for these members, default to -1 (is this valid?)
          sortby = lambda nt: self.ev2idx.get(getattr(nt, codekey), -1)
          return sorted(nt_list, key=sortby)