def sync(rsync, source, destination, link_dest=None, exclude=None):
    command = [rsync, '-v', '-a', '--no-D', '--delete', '--ignore-existing']
    if link_dest:
        command.extend(['--link-dest', link_dest])
    exclude = (exclude or [])
    if exclude:
        command.extend([arg for path in exclude for arg in ['--exclude', path]])
    if (os.path.isdir(source) and (source[(- 1)] != os.path.sep)):
        source += os.path.sep
    command.extend([source, destination])
    subprocess.check_call(command)
def sync(rsync, source, destination, link_dest=None, exclude=None):
    command = [rsync, '-v', '-a', '--no-D', '--delete', '--ignore-existing']
    if link_dest:
        command.extend(['--link-dest', link_dest])
    exclude = (exclude or [])
    if exclude:
        command.extend([arg for path in exclude for arg in ['--exclude', path]])
    if (os.path.isdir(source) and (source[(- 1)] != os.path.sep)):
        source += os.path.sep
    command.extend([source, destination])
    subprocess.check_call(command)