code: def Stop(self):
      
      if not self.__running:
        return
      logging.info('shutting down the emulator running at %s', self._host)
      headers = {'Content-length': '0'}
      response, _ = self._http.request('%s/shutdown' % self._host,
                                       method='POST', headers=headers)
      if response.status != 200:
        logging.warning('failed to shut down emulator; response: %s', response)
  
      self.__running = False
      # Delete temp files.
      shutil.rmtree(self._tmp_dir)
docs: Stops the emulator instance.