<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def visit_functiondef(self, node):
 """ A interface will be called when visiting a function or a method. @param node: the current node """

        if not node.is_method():
            # We only check methods.
            return

        name = node.name

        if isTestModule(node.root().name):
            if name.startswith('test'):
                if not name.startswith('test_'):
                    self.add_message('C9303', node=node)
                    return
                else:
                    # Test names start with 'test_NAME' and can be like
                    # test_SOME_NAME or test_render_SomeCondition.
                    return

        if name[0].isupper():
            self.add_message('C9302', node=node)
            return

        if name.startswith('___'):
            self.add_message('C9302', node=node)
            return

        if name.endswith('___'):
            self.add_message('C9302', node=node)
            return

        if name.startswith('__'):
            if name.endswith('___'):
                # To many trailing underscores.
                self.add_message('C9302', node=node)
                return
            if name.endswith('_') and not name.endswith('__'):
                # To few trailing underscored
                self.add_message('C9302', node=node)
                return
            if name.endswith('__'):
                # This is a reserved name and we don't do any checks on it.
                return
            name = name[2:-2]

        if name.startswith('_'):
            name = name[1:]

        if name.endswith('_'):
            self.add_message('C9302', node=node)
            return

        if '_' in name:
            # This has a underscore in the main name.
            prefix = self._getMethodNamePrefix(node)
            if prefix:
                # There are other names with same prefix so this should be
                # a dispatched method.
                return

            self.add_message('C9302', node=node)
            return


        if isTestModule(node.name) and self.moduleContainsTestCase(node):
            self._checkTestMethodName(node)