docs: def deep_merge_dict(a, b):
      """Deep merges dictionary b into dictionary a."""
      if not isinstance(a, dict):
          raise TypeError("a must be a dict, but found %s" % a.__class__.__name__)
      if not isinstance(b, dict):
          raise TypeError("b must be a dict, but found %s" % b.__class__.__name__)
  
      _a = copy(a)
      _b = copy(b)
  
      for key_b, val_b in iteritems(_b):
          # if it's a sub-dictionary
          if isinstance(val_b, dict):
              if key_b not in _a or not isinstance(_a[key_b], dict):
                  _a[key_b] = {}
  
              # perform the deep merge recursively
              _a[key_b] = deep_merge_dict(_a[key_b], val_b)
          else:
              _a[key_b] = val_b
  
      # b should now be deep-merged into a
      return _a