def producer(obj, func, results):
 try:
  result = func(obj)
  results.put((obj, result, None))
 except Exception as e:
  results.put((obj, None, e))

def producer ( obj , func , results ) : try : result = func ( obj ) results . put ( ( obj , result , None ) ) except Exception as e : results . put ( ( obj , None , e ) )
the entry point for a producer thread which runs func on a single object .