human
I wrote the below code

    if isinstance(children, dict):
        keys = list(children.keys())
        children = children.values()
    else:
        keys = None
    assert all((is_future(i) for i in children))
    unfinished_children = set(children)
    future = Future()
    if (not children):
        future.set_result(({} if (keys is not None) else []))
    def callback(f):
        unfinished_children.remove(f)
        if (not unfinished_children):
            try:
                result_list = [i.result() for i in children]
            except Exception:
                future.set_exc_info(sys.exc_info())
            else:
                if (keys is not None):
                    future.set_result(dict(zip(keys, result_list)))
                else:
                    future.set_result(result_list)
    for f in children:
        f.add_done_callback(callback)
    return future

What's a good function header?
 Here's a good function header?
assistant
#Here's a good function header.

def multi_future(children):