code: def _yield_sorted_items(iterable):
      """Yield (key, value) pairs for `iterable` in a deterministic order.
  
      For Sequences, the key will be an int, the array index of a value.
      For Mappings, the key will be the dictionary key.
      For objects (e.g. namedtuples), the key will be the attribute name.
  
      In all cases, the keys will be iterated in sorted order.
  
      Args:
        iterable: an iterable.
  
      Yields:
        The iterable's (key, value) pairs, in order of sorted keys.
      """
      if not is_nested(iterable):
          raise ValueError(f"{iterable} is not an iterable")
  
      top_structure = dm_tree.traverse(
          lambda x: None  # pylint: disable=g-long-lambda
          if x is iterable
          else False,
          iterable,
      )
  
      for p, v in dm_tree.flatten_with_path_up_to(
          top_structure, iterable
      ):
          yield p[0], v
  
imports: import collections
  from collections import abc
  import types
  import tree
label_desc: Use image node_id 18 for calling a global function with example usage: _yield_sorted_items(iterable) without return types