def expand_reverse_relationships(model: Type["Model"]) -> None:
    """
    Iterates through model_fields of given model and verifies if all reverse
    relation have been populated on related models.

    If the reverse relation has not been set before it's set here.

    :param model: model on which relation should be checked and registered
    :type model: Model class
    """
    model_fields = list(model.ormar_config.model_fields.values())
    for model_field in model_fields:
        if (
            model_field.is_relation
            and not model_field.has_unresolved_forward_refs()
            and not model_field.is_through
        ):
            model_field = cast("ForeignKeyField", model_field)
            expand_reverse_relationship(model_field=model_field)

    Iterates through model_fields of given model and verifies if all reverse
    relation have been populated on related models.

    If the reverse relation has not been set before it's set here.

    :param model: model on which relation should be checked and registered
    :type model: Model class
    
ormar/models/helpers/relations.py