def assert_is_not_none(obj, msg=None): """Same as assert_false(obj is None), with a nicer default message.""" if not msg: msg = '{orig!r} is None'.format(orig=obj) assert_false(obj is None, msg=msg)