futures from concurrent futures import threadpoolexecutor from time import sleep from random import randint def is_even( )print('checking if' 'is even'sleep(randint( )return str(nstr( = def print_future_result(future)print('in callback future result'future result()print('started'data [ pool threadpoolexecutor( for in datafuture pool submit(is_evenvfuture add_done_callback(print_future_resultprint('done'when we run thiswe can see that the call back function is called after the main thread has completed againthe order is unspecified as the is_even(function still sleeps for random amount of time started checking if is even checking if is even checking if is even checking if is even checking if is even done in callback future resultchecking if is even in callback future resultin callback future resultin callback future resultin callback future resultin callback future result false false true false true true