def has_dynamic_getattr(self, context=None):
        """Check if the class has a custom __getattr__ or __getattribute__.

        If any such method is found and it is not from
        builtins, nor from an extension module, then the function
        will return True.

        :returns: True if the class has a custom
            __getattr__ or __getattribute__, False otherwise.
        :rtype: bool
        """

        def _valid_getattr(node):
            root = node.root()
            return root.name != BUILTINS and getattr(root, "pure_python", None)

        try:
            return _valid_getattr(self.getattr("__getattr__", context)[0])
        except exceptions.AttributeInferenceError:
            # if self.newstyle: XXX cause an infinite recursion error
            try:
                getattribute = self.getattr("__getattribute__", context)[0]
                return _valid_getattr(getattribute)
            except exceptions.AttributeInferenceError:
                pass
        return False
Check if the class has a custom __getattr__ or __getattribute__.

        If any such method is found and it is not from
        builtins, nor from an extension module, then the function
        will return True.

        :returns: True if the class has a custom
            __getattr__ or __getattribute__, False otherwise.
        :rtype: bool