<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rsync(from_path, to_path, flags='-r', options=None, timeout=None):
 """Replicate the contents of a path"""

    options = options or ['--delete', '--executability']
    cmd = ['/usr/bin/rsync', flags]
    if timeout:
        cmd = ['timeout', str(timeout)] + cmd
    cmd.extend(options)
    cmd.append(from_path)
    cmd.append(to_path)
    log(" ".join(cmd))
    return subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode('UTF-8').strip()