docs: def save_package_contents(self, root, team, owner, pkgname):
          """
          Saves the in-memory contents to a file in the local
          package repository.
          """
          assert isinstance(root, RootNode)
          instance_hash = hash_contents(root)
          pkg_path = self.package_path(team, owner, pkgname)
          if not os.path.isdir(pkg_path):
              os.makedirs(pkg_path)
              os.mkdir(os.path.join(pkg_path, self.CONTENTS_DIR))
              os.mkdir(os.path.join(pkg_path, self.TAGS_DIR))
              os.mkdir(os.path.join(pkg_path, self.VERSIONS_DIR))
  
          dest = os.path.join(pkg_path, self.CONTENTS_DIR, instance_hash)
          with open(dest, 'w') as contents_file:
              json.dump(root, contents_file, default=encode_node, indent=2, sort_keys=True)
  
          tag_dir = os.path.join(pkg_path, self.TAGS_DIR)
          if not os.path.isdir(tag_dir):
              os.mkdir(tag_dir)
  
          latest_tag = os.path.join(pkg_path, self.TAGS_DIR, self.LATEST)
          with open (latest_tag, 'w') as tagfile:
              tagfile.write("{hsh}".format(hsh=instance_hash))