def _pd_to_hdf(pd_to_hdf, lock, args, kwargs=None):
 if lock:
  lock.acquire()
 try:
  pd_to_hdf(*args, **kwargs)
 finally:
  if lock:
   lock.release()
 return None

def _pd_to_hdf ( pd_to_hdf , lock , args , kwargs = None ) : if lock : lock . acquire ( ) try : pd_to_hdf ( * args , ** kwargs ) finally : if lock : lock . release ( ) return None
a wrapper function around pd_to_hdf that enables locking .