def classof(obj):
    """If `obj` is class object return the same. Other wise assume that it is
    an instance object and return its class."""
    if isinstance(obj, type):
        return obj
    else:
        return getattr(obj, '__class__', None)
