def obtain_lock_id(pid=None):
 id = (-1)
 id = obtain_lock_id_to_hog()
 try:
  if (id >= 0):
   if (pid is None):
    pid = os.getpid()
   _launch_reaper(id, pid)
 except:
  free_lock(id)
  id = (-1)
 return id

def obtain_lock_id ( pid = None ) : id = ( - 1 ) id = obtain_lock_id_to_hog ( ) try : if ( id >= 0 ) : if ( pid is None ) : pid = os . getpid ( ) _launch_reaper ( id , pid ) except : free_lock ( id ) id = ( - 1 ) return id
finds a free id .