code: def directory_tarball(dirname):
      
      assert os.path.isdir(dirname), dirname
      base_dir, tarball_dir = os.path.split(dirname)
      while not os.path.exists(os.path.join(base_dir, "seq")) and base_dir and base_dir != "/":
          base_dir, extra_tarball = os.path.split(base_dir)
          tarball_dir = os.path.join(extra_tarball, tarball_dir)
      if base_dir == "/" and not os.path.exists(os.path.join(base_dir, "seq")):
          raise ValueError("Did not find relative directory to create tarball for %s" % dirname)
      tarball = os.path.join(base_dir, "%s-wf.tar.gz" % (tarball_dir.replace(os.path.sep, "--")))
      if not utils.file_exists(tarball):
          print("Preparing CWL input tarball: %s" % tarball)
          with file_transaction({}, tarball) as tx_tarball:
              with utils.chdir(base_dir):
                  with tarfile.open(tx_tarball, "w:gz") as tar:
                      tar.add(tarball_dir)
      return tarball
docs: Create a tarball of a complex directory, avoiding complex secondaryFiles.
  
      Complex secondary files do not work on multiple platforms and are not portable
      to WDL, so for now we create a tarball that workers will unpack.