docs: def get_flat_models_from_fields(fields: Sequence[Field]) -> Set[Type['main.BaseModel']]:
      """
      Take a list of Pydantic  ``Field``s (from a model) that could have been declared as sublcasses of ``BaseModel``
      (so, any of them could be a submodel), and generate a set with their models and all the sub-models in the tree.
      I.e. if you pass a the fields of a model ``Foo`` (subclass of ``BaseModel``) as ``fields``, and on of them has a
      field of type ``Bar`` (also subclass of ``BaseModel``) and that model ``Bar`` has a field of type ``Baz`` (also
      subclass of ``BaseModel``), the return value will be ``set([Foo, Bar, Baz])``.
  
      :param fields: a list of Pydantic ``Field``s
      :return: a set with any model declared in the fields, and all their sub-models
      """
      flat_models: Set[Type['main.BaseModel']] = set()
      for field in fields:
          flat_models |= get_flat_models_from_field(field)
      return flat_models