Check with type(X) is type
type(X) is type
>>> type(Exception) is type True >>> type(3) is type False >>> class Dummy: pass >>> type(Dummy) is type True
Inspired by S.Lott's anwser.