code: def _StartMonitoringProcess(self, process):
      
      if process is None:
        raise ValueError('Missing process.')
  
      pid = process.pid
  
      if pid in self._process_information_per_pid:
        raise KeyError(
            'Already monitoring process (PID: {0:d}).'.format(pid))
  
      if pid in self._rpc_clients_per_pid:
        raise KeyError(
            'RPC client (PID: {0:d}) already exists'.format(pid))
  
      rpc_client = plaso_xmlrpc.XMLProcessStatusRPCClient()
  
      # Make sure that a worker process has started its RPC server.
      # The RPC port will be 0 if no server is available.
      rpc_port = process.rpc_port.value
      time_waited_for_process = 0.0
      while not rpc_port:
        time.sleep(0.1)
        rpc_port = process.rpc_port.value
        time_waited_for_process += 0.1
  
        if time_waited_for_process >= self._RPC_SERVER_TIMEOUT:
          raise IOError(
              'RPC client unable to determine server (PID: {0:d}) port.'.format(
                  pid))
  
      hostname = 'localhost'
  
      if not rpc_client.Open(hostname, rpc_port):
        raise IOError((
            'RPC client unable to connect to server (PID: {0:d}) '
            'http://{1:s}:{2:d}').format(pid, hostname, rpc_port))
  
      self._rpc_clients_per_pid[pid] = rpc_client
      self._process_information_per_pid[pid] = process_info.ProcessInfo(pid)
docs: Starts monitoring a process.
  
      Args:
        process (MultiProcessBaseProcess): process.
  
      Raises:
        IOError: if the RPC client cannot connect to the server.
        KeyError: if the process is not registered with the engine or
            if the process is already being monitored.
        OSError: if the RPC client cannot connect to the server.
        ValueError: if the process is missing.