code: def cleanup(self):
          
          if getattr(self._finalizer, "detach", None) and self._finalizer.detach():
              if os.path.exists(self.path):
                  try:
                      rmtree(self.path)
                  except OSError:
                      pass
                  else:
                      self.path = None
docs: Remove the temporary directory created and reset state