code: def close(self):
          '''Terminate or kill the subprocess.
  
          This function is blocking.
          '''
          if not self._process:
              return
  
          if self._process.returncode is not None:
              return
  
          _logger.debug('Terminate process.')
  
          try:
              self._process.terminate()
          except OSError as error:
              if error.errno != errno.ESRCH:
                  raise
  
          for dummy in range(10):
              if self._process.returncode is not None:
                  return
  
              time.sleep(0.05)
  
          _logger.debug('Failed to terminate. Killing.')
  
          try:
              self._process.kill()
          except OSError as error:
              if error.errno != errno.ESRCH:
                  raisf close(self):
          '''Terminate or kill the subprocess.
  
          This function is blocking.
          '''
          if not self._process:
              return
  
          if self._process.returncode is not None:
              return
  
          _logger.debug('Terminate process.')
  
          try:
              self._process.terminate()
          except OSError as error:
              if error.errno != errno.ESRCH:
                  raise
  
          for dummy in range(10):
              if self._process.returncode is not None:
                  return
  
              time.sleep(0.05)
  
          _logger.debug('Failed to terminate. Killing.')
  
          try:
              self._process.kill()
          except OSError as error:
              if error.errno != errno.ESRCH:
                  raise
docs: Terminate or kill the subprocess.
  
          This function is blocking.