code: def _sorted_map_iter(d, sort=True):
      if sort:
          try:
              ord_keys = sorted(d.keys())
          except TypeError as e:
              raise TypeError(
                  "Sorting not supported. Please pass sort=False"
              ) from e
      else:
          ord_keys = d.keys()
      for k in ord_keys:
          yield (k, d[k])
  
imports: from copy import copy
  from inspect import signature, _empty
  import re
  from collections.abc import Iterable
  from collections import defaultdict
  from itertools import product
  from six import string_types
label_desc: Use image node_id 10 for calling a global function with example usage: _sorted_map_iter(d, sort) without return types