def METHOD_NAME(self):
    if self.write_task is not None:
        self.write_task.cancel()
    self.read_stdout_task.cancel()
    try:
        self.proc.METHOD_NAME()
        log.debug("SubProcess.terminate()", extra={"task": self.defname})
    except ProcessLookupError:
        log.debug(
            "SubProcess.terminate(): ProcessLookupError",
            extra={"task": self.defname},
        )
    self.terminated = True