<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _TerminateProcessByPid(self, pid):
 """Terminate a process that's monitored by the engine. Args: pid (int):
 process identifier (PID). Raises: KeyError: if the process is not registered with and monitored by the engine. """

    self._RaiseIfNotRegistered(pid)

    process = self._processes_per_pid[pid]

    self._TerminateProcess(process)
    self._StopMonitoringProcess(process)