import inspect


def isexception(obj):
	"""Given an object, return a boolean indicating whether it is an instance
    or subclass of :py:class:`Exception`.
    stolen from: https://github.com/kennethreitz/records/blob/master/records.py
    """
	if isinstance(obj, Exception):
		return True
	if inspect.isclass(obj) and issubclass(obj, Exception):
		return True
	return False