def METHOD_NAME(self) -> Union[Dict, str]:
    """to_dict serializes the type instance into a python dictionary or
    string."""
    return {
        type(self).__name__: self.__dict__
    } if self.__dict__ else type(self).__name__