def METHOD_NAME(cls, exclude: Union[Set, Dict, None]) -> Set:
    """
    Used during generation of the dict().
    To avoid cyclical references and max recurrence limit nested models have to
    exclude related models that are not mandatory.
    For a main model (not nested) only nullable related field names are added to
    exclusion, for nested models all related models are excluded.
    :param exclude: set/dict with fields to exclude
    :type exclude: Union[Set, Dict, None]
    :return: set or dict with excluded fields added.
    :rtype: Union[Set, Dict]
    """
    exclude = exclude or set()
    related_set = cls.extract_related_names()
    if isinstance(exclude, set):
        exclude = {s for s in exclude}
        exclude = exclude.union(related_set)
    elif isinstance(exclude, dict):
        # relations are handled in ormar - take only own fields (ellipsis in dict)
        exclude = {k for k, v in exclude.items() if v is Ellipsis}
        exclude = exclude.union(related_set)
    return exclude