code: def mapping_to_frozenset(mapping):
      
      mapping = mapping.copy()
      for key, value in mapping.items():
          if isinstance(value, Mapping):
              mapping[key] = mapping_to_frozenset(value)
          elif isinstance(value, Sequence):
              value = list(value)
              for i, item in enumerate(value):
                  if isinstance(item, Mapping):
                      value[i] = mapping_to_frozenset(item)
              mapping[key] = tuple(value)
      return frozenset(mapping.items())
docs: Be aware that this treats any sequence type with the equal members as
          equal. As it is used to identify equality of schemas, this can be
          considered okay as definitions are semantically equal regardless the
          container type.