parameters: (object_to_write, filename, write_func)
return_statement: return temporary_filename
docstring: Writes an object into a unique file in a concurrency-safe way.
docstring_summary: Writes an object into a unique file in a concurrency-safe way.
docstring_tokens: Writes an object into a unique file in a concurrency - safe way .
function: def concurrency_safe_write(object_to_write, filename, write_func):
      """Writes an object into a unique file in a concurrency-safe way."""
      thread_id = id(threading.current_thread())
      temporary_filename = '{}.thread-{}-pid-{}'.format(
          filename, thread_id, os.getpid())
      write_func(object_to_write, temporary_filename)
  
      return temporary_filename
function_tokens: def concurrency_safe_write ( object_to_write , filename , write_func ) : thread_id = id ( threading . current_thread ( ) ) temporary_filename = '{}.thread-{}-pid-{}' . format ( filename , thread_id , os . getpid ( ) ) write_func ( object_to_write , temporary_filename ) return temporary_filename