import inspect


def class_(obj):
    """Return a class from an object

    Often in itk, the __class__ is not what the user is expecting.
    class_() should do a better job
    """

    if inspect.isclass(obj):
        # obj is already a class !
        return obj
    else:
        return obj.__class__