'This interface is designed to match server.hosts.abstract_ssh.get_file
(and send_file).  That is, if the source_path ends with a slash, the
contents of the directory are copied; otherwise, the directory iself is
copied.'

def copy_file_or_directory(self, source_path, destination_path):

    if self._same_file(source_path, destination_path):
        return
    self._ensure_directory_exists(os.path.dirname(destination_path))
    if source_path.endswith('/'):
        assert os.path.isdir(source_path)
        assert os.path.isdir(destination_path)
        for filename in os.listdir(source_path):
            self.copy_file_or_directory(os.path.join(source_path, filename), os.path.join(destination_path, filename))
    elif os.path.isdir(source_path):
        shutil.copytree(source_path, destination_path, symlinks=True)
    elif os.path.islink(source_path):
        link_to = os.readlink(source_path)
        os.symlink(link_to, destination_path)
    else:
        shutil.copy(source_path, destination_path)
