def rsync(options, from_path, to_path):
    """
    basic rsync wrapper
    :param options:
    :param from_path:
    :param to_path:
    :return:
    """
    import subprocess
    print('Starting: rsync %s %s %s' % (options, from_path, to_path))
    if not type(options) is list:
        options = [options]
    command = subprocess.Popen(['rsync'] + options + [from_path, to_path],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1)
    if 'v' in options:
        while True:
            line = command.stdout.readline()
            if line != '':
                print(line.rstrip())
            else:
                break
    err = command.stderr.read().strip()
    if err:
        msg = (
            """rsync received messages on stderr. This might indicate that the command failed or, if you transferred to a remote server, it might just be some message received by the remote server. 
This is because rsync automatically forwards all messages by the remote server to stderr. 
If you are confident that the call succeeded although stderr received messages, then catch the RuntimeError accordingly.
 The messages received are: 
 %s"""
             % err)
        raise RuntimeError(msg)
    print('rsync finished')
    return True
