def hasattr(o, a, orig_hasattr=hasattr):
    if orig_hasattr(o, '__hasattr__'):
        return o.__hasattr__(a)
return orig_hasattr(o, a)
__builtins__.hasattr = hasattr
How to prevent hasattr from retrieving the attribute value itself