from typing import Union
import inspect


def get_model_name(cls: Union[type, object] = None) -> str:
    """Return the model name for the given class."""
    if not inspect.isclass(cls):
        cls = cls.__class__
    return '{}.{}'.format(cls.__module__, cls.__name__)