def pid_by_open_file(path):
 if is_available('lsof'):
  results = call((GET_PID_BY_FILE_LSOF % path), [])
  if (len(results) == 1):
   pid = results[0].strip()
   if pid.isdigit():
    return int(pid)
 return None

def pid_by_open_file ( path ) : if is_available ( 'lsof' ) : results = call ( ( GET_PID_BY_FILE_LSOF % path ) , [ ] ) if ( len ( results ) == 1 ) : pid = results [ 0 ] . strip ( ) if pid . isdigit ( ) : return int ( pid ) return None
attempts to determine the process id for a process with the given open file .