code: def setup_destination(self):
          
          # Do we have a separate identifier?
          if (not self.identifier):
              # No separate identifier specified, split off the last path segment
              # of the source name, strip the extension to get the identifier
              self.identifier = os.path.splitext(os.path.split(self.src)[1])[0]
          # Done if dryrun, else setup self.dst first
          if (self.dryrun):
              return
          if (not self.dst):
              raise IIIFStaticError("No destination directory specified!")
          dst = self.dst
          if (os.path.isdir(dst)):
              # Exists, OK
              pass
          elif (os.path.isfile(dst)):
              raise IIIFStaticError(
                  "Can't write to directory %s: a file of that name exists" % dst)
          else:
              os.makedirs(dst)
          # Second, create identifier based subdir if necessary
          outd = os.path.join(dst, self.identifier)
          if (os.path.isdir(outd)):
              # Nothing for now, perhaps should delete?
              self.logger.warning(
                  "Output directory %s already exists, adding/updating files" % outd)
              pass
          elif (os.path.isfile(outd)):
              raise IIIFStaticError(
                  "Can't write to directory %s: a file of that name exists" % outd)
          else:
              os.makedirs(outd)
          self.logger.debug("Output directory %s" % outd)
docs: Setup output directory based on self.dst and self.identifier.
  
          Returns the output directory name on success, raises and exception on
          failure.