docs: def deep_map(f, root):
      """Sibling to |inverse_deep_map|. As :py:func:`map` maps over an iterable,
      |deep_map| maps over a structure of nested ``dict``s and ``list``s. Every
      object is passed through `f` recursively. That is, first `root` is mapped,
      next any object contained in its result, and so on.
  
      No distinction is made between tuples and lists. This function was
      created with encoding to JSON compatible data in mind.
  
      .. |deep_map| replace:: :py:func:`deep_map`"""
      result = f(root)
  
      if isinstance(result, dict):
          return {k: deep_map(f, v) for k, v in result.items()}
  
      if isinstance(result, list) or isinstance(result, tuple):
          return [deep_map(f, v) for v in result]
  
      return result