nodes: 0, module; 1, function_definition; 2, function_name:csort; 3, parameters; 4, block; 5, identifier:objs; 6, identifier:key; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Order-preserving sorting function."""; 11, assignment; 12, call; 13, identifier:idxs; 14, call; 15, identifier:sorted; 16, argument_list; 17, identifier:dict; 18, generator_expression; 19, identifier:objs; 20, keyword_argument; 21, tuple; 22, for_in_clause; 23, identifier:key; 24, lambda; 25, identifier:obj; 26, identifier:i; 27, tuple_pattern; 28, call; 29, lambda_parameters; 30, tuple; 31, identifier:i; 32, identifier:obj; 33, identifier:enumerate; 34, argument_list; 35, identifier:obj; 36, call; 37, subscript; 38, identifier:objs; 39, identifier:key; 40, argument_list; 41, identifier:idxs; 42, identifier:obj; 43, identifier:obj
code: def csort(objs, key):
      """Order-preserving sorting function."""
      idxs = dict((obj, i) for (i, obj) in enumerate(objs))
      return sorted(objs, key=lambda obj: (key(obj), idxs[obj]))