def copytree(self, packagepath, src, dest, remove=False):
        """
        Copies a package directory tree.
        :param packagepath: relative path of the (sub-)package, e.g. 'package/subpackage/'
        :type packagepath: str
        :param src: path to the actual source of the root package
        :type src: str
        :param dest: path to copy to
        :type dest: str
        :return: the path to which the directories have been copied.
        :trype: str
        """
        if self.verbose:
            print("Copying {s} -> {d}".format(s=src, d=dest))
        if os.path.isfile(src):
            if os.path.isdir(dest):
                dest = os.path.join(dest, os.path.basename(src))
            if os.path.exists(dest) and remove:
                os.remove(dest)
            shutil.copy(src, dest)
            return dest
        else:
            target = os.path.join(
                dest,
                # os.path.basename(os.path.normpath(src)),
                packagepath,
            )
            if os.path.exists(target) and remove:
                shutil.rmtree(target)
            shutil.copytree(src, target)
            return target

        Copies a package directory tree.
        :param packagepath: relative path of the (sub-)package, e.g. 'package/subpackage/'
        :type packagepath: str
        :param src: path to the actual source of the root package
        :type src: str
        :param dest: path to copy to
        :type dest: str
        :return: the path to which the directories have been copied.
        :trype: str
        
lib/stashutils/wheels.py