nodes: 0, module; 1, function_definition; 2, function_name:sort_ordered_objects; 3, parameters; 4, block; 5, identifier:items; 6, default_parameter; 7, expression_statement; 8, return_statement; 9, identifier:getter; 10, lambda; 11, comment:"""Sort an iterable of OrderedBase instances.
  
      Args:
          items (iterable): the objects to sort
          getter (callable or None): a function to extract the OrderedBase instance from an object.
  
      Examples:
          >>> sort_ordered_objects([x, y, z])
          >>> sort_ordered_objects(v.items(), getter=lambda e: e[1])
      """; 12, call; 13, lambda_parameters; 14, identifier:x; 15, identifier:sorted; 16, argument_list; 17, identifier:x; 18, identifier:items; 19, keyword_argument; 20, identifier:key; 21, lambda; 22, lambda_parameters; 23, call; 24, identifier:x; 25, identifier:getattr; 26, argument_list; 27, call; 28, attribute; 29, unary_operator; 30, identifier:getter; 31, argument_list; 32, identifier:OrderedBase; 33, identifier:CREATION_COUNTER_FIELD; 34, integer:1; 35, identifier:x
code: def sort_ordered_objects(items, getter=lambda x: x):
      """Sort an iterable of OrderedBase instances.
  
      Args:
          items (iterable): the objects to sort
          getter (callable or None): a function to extract the OrderedBase instance from an object.
  
      Examples:
          >>> sort_ordered_objects([x, y, z])
          >>> sort_ordered_objects(v.items(), getter=lambda e: e[1])
      """
      return sorted(items, key=lambda x: getattr(getter(x), OrderedBase.CREATION_COUNTER_FIELD, -1))