'Sync a single file using rsync. Used by _rsync_db to handle syncing.
:param db_file: file to be synced
:param remote_file: remote location to sync the DB file to
:param whole-file: if True, uses rsync\'s --whole-file flag
:param different_region: if True, the destination node is in a
different region
:returns: True if the sync was successful, False otherwise'

def _rsync_file(self, db_file, remote_file, whole_file=True, different_region=False):

    popen_args = ['rsync', '--quiet', '--no-motd', ('--timeout=%s' % int(math.ceil(self.node_timeout))), ('--contimeout=%s' % int(math.ceil(self.conn_timeout)))]
    if whole_file:
        popen_args.append('--whole-file')
    if (self.rsync_compress and different_region):
        popen_args.append('--compress')
    popen_args.extend([db_file, remote_file])
    proc = subprocess.Popen(popen_args)
    proc.communicate()
    if (proc.returncode != 0):
        self.logger.error(_('ERROR    rsync    failed    with    %(code)s:    %(args)s'), {'code': proc.returncode, 'args': popen_args})
    return (proc.returncode == 0)
