'Return whether the node occurs (directly) inside a class.'

def is_method(self, node):

    node = node.parent
    while (node is not None):
        if (node.type == syms.classdef):
            return True
        if (node.type == syms.funcdef):
            return False
        node = node.parent
    return False
