code: def read_pid_file(pidfile_path):
      
  
      try:
          fin = open(pidfile_path, "r")
      except Exception, e:
          return None
  
      else:
          pid_data = fin.read().strip()
          fin.close()
  
          try:
              pid = int(pid_data)
              return pid
          except:
              return None
docs: Read the PID from the PID file