'Copy files from the remote host to a local path.
Directories will be copied recursively.
If a source component is a directory with a trailing slash,
the content of the directory will be copied, otherwise, the
directory itself and its content will be copied. This
behavior is similar to that of the program \'rsync\'.
Args:
source: either
1) a single file or directory, as a string
2) a list of one or more (possibly mixed)
files or directories
dest: a file or a directory (if source contains a
directory or more than one element, you must
supply a directory dest)
delete_dest: if this is true, the command will also clear
out any old files at dest that are not in the
source
preserve_perm: tells get_file() to try to preserve the sources
permissions on files and dirs
preserve_symlinks: try to preserve symlinks instead of
transforming them into files/dirs on copy
Raises:
AutoservRunError: the scp command failed'

def get_file(self, source, dest, delete_dest=False, preserve_perm=True, preserve_symlinks=False):

    self.start_master_ssh()
    if isinstance(source, basestring):
        source = [source]
    dest = os.path.abspath(dest)
    try_scp = True
    if self.use_rsync():
        try:
            remote_source = self._encode_remote_paths(source)
            local_dest = utils.sh_escape(dest)
            rsync = self._make_rsync_cmd([remote_source], local_dest, delete_dest, preserve_symlinks)
            utils.run(rsync)
            try_scp = False
        except error.CmdError as e:
            logging.warn(('trying    scp,    rsync    failed:    %s' % e))
    if try_scp:
        if (delete_dest and os.path.isdir(dest)):
            shutil.rmtree(dest)
            os.mkdir(dest)
        remote_source = self._make_rsync_compatible_source(source, False)
        if remote_source:
            remote_source = self._encode_remote_paths(remote_source, escape=False)
            local_dest = utils.sh_escape(dest)
            scp = self._make_scp_cmd([remote_source], local_dest)
            try:
                utils.run(scp)
            except error.CmdError as e:
                raise error.AutoservRunError(e.args[0], e.args[1])
    if (not preserve_perm):
        self._set_umask_perms(dest)
