@plug.handler()
def get_file(metadata):
    plug.logger.debug(u"Getting remote file {}", metadata.path)
    try:
        f = sftp.open(metadata.path, 'r')
        # "If reading the entire file, pre-fetching can dramatically improve
        # the download speed by avoiding roundtrip latency."
        # http://docs.paramiko.org/en/latest/api/sftp.html
        # #paramiko.sftp_file.SFTPFile.prefetch
        f.prefetch()
        data = f.read()
        return data
    except __HOLE__ as e:
        raise ServiceError("Error getting file '{}': {}"
                           .format(metadata.path, e))
dataset/ETHPy150Open onitu/onitu/drivers/sftp/onitu_sftp/sftp.py/get_file