def combine_futures(*futures):
expected = len(futures)<EOL>results = []<EOL>completed = AtomicInteger()<EOL>combined = Future()<EOL>def done(f):<EOL><INDENT>if not combined.done():<EOL><INDENT>if f.is_success():  <EOL><INDENT>results.append(f.result())<EOL>if completed.get_and_increment() + <NUM_LIT:1> == expected:<EOL><INDENT>combined.set_result(results)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>combined.set_exception(f.exception(), f.traceback())<EOL><DEDENT><DEDENT><DEDENT>for future in futures:<EOL><INDENT>future.add_done_callback(done)<EOL><DEDENT>return combined<EOL>
Combines set of Futures.

:param futures: (Futures), Futures to be combined.
:return: Result of the combination.