import inspect


def get_class_string(obj):
    """
    Return the string identifying the class of the object (module + object name,
    joined by dots).

    It works both for classes and for class instances.
    """
    if inspect.isclass(obj):
        return "{}.{}".format(
            obj.__module__,
            obj.__name__)     
    else:
        return "{}.{}".format(
            obj.__module__,
            obj.__class__.__name__)