docs: def _prepare_tmp_directory(self, tmp_dir):
          """ Creates temporary directory that is used to work on layers """
  
          if tmp_dir:
              if os.path.exists(tmp_dir):
                  raise SquashError(
                      "The '%s' directory already exists, please remove it before you proceed" % tmp_dir)
              os.makedirs(tmp_dir)
          else:
              tmp_dir = tempfile.mkdtemp(prefix="docker-squash-")
  
          self.log.debug("Using %s as the temporary directory" % tmp_dir)
  
          return tmp_dir