'Set the line numbers of the node and children.'

def set_lineno(self, lineno, override=False):

    todo = deque([self])
    while todo:
        node = todo.popleft()
        if ('lineno' in node.attributes):
            if ((node.lineno is None) or override):
                node.lineno = lineno
        todo.extend(node.iter_child_nodes())
    return self
