def METHOD_NAME(self, idx):
    """
    Yield all children of the given root up to a maximum number stored in options.maxcalls.
    """
    if idx == 0:
        root = self.call_tree['$total']
    else:
        root = self.node_list[idx]
        root = self.call_tree[root['id']]
    maxcalls = self.options.maxcalls
    stack = deque()
    stack.appendleft(root)
    callcount = 1
    stop_adding = False
    while stack:
        parent, children = stack.pop()
        yield parent
        if not stop_adding:
            callcount += len(children)
            if callcount <= maxcalls:
                for child in children.values():
                    stack.appendleft(self.call_tree[child['id']])
            else:
                stop_adding = True