def METHOD_NAME(self, node):
    if isinstance(node, tuple):
        element, key, parents, flag = node
    else:
        return None
    if flag == "text":
        if len(element):
            parents.append(element)
            return element[0], 0, parents, None
        else:
            return None
    else:
        if element.tail and flag != "tail":
            return element, key, parents, "tail"
        elif key < len(parents[-1]) - 1:
            return parents[-1][key + 1], key + 1, parents, None
        else:
            return None