<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sysprep(disk, distro, loader=None, backend='direct', **kwargs):
 """ Run virt-sysprep on the ``disk``, commands are built from the distro specific template and arguments passed in ``kwargs``. If no template is available it will default to ``sysprep-base.j2``. Args: disk(str):
 path to disk distro(str):
 distro to render template for loader(jinja2.BaseLoader):
 Jinja2 template loader, if not passed, will search Lago's package. backend(str):
 libguestfs backend to use **kwargs(dict):
 environment variables for Jinja2 template Returns: None Raises: RuntimeError: On virt-sysprep none 0 exit code. """


    if loader is None:
        loader = PackageLoader('lago', 'templates')
    sysprep_file = _render_template(distro, loader=loader, **kwargs)

    cmd = ['virt-sysprep', '-a', disk]
    cmd.extend(['--commands-from-file', sysprep_file])

    env = os.environ.copy()
    if 'LIBGUESTFS_BACKEND' not in env:
        env['LIBGUESTFS_BACKEND'] = backend

    ret = utils.run_command(cmd, env=env)
    if ret:
        raise RuntimeError(
            'Failed to bootstrap %s\ncommand:%s\nstdout:%s\nstderr:%s' % (
                disk,
                ' '.join('"%s"' % elem for elem in cmd),
                ret.out,
                ret.err,
            )
        )