code: def sort_ordered_objects(items, getter=lambda x: x):
      
      return sorted(items, key=lambda x: getattr(getter(x), OrderedBase.CREATION_COUNTER_FIELD, -1))
docs: 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])