def convert_systemd_target_to_runlevel(target):
    """
    Convert systemd target to runlevel.

    :param target: systemd target
    :type target: str
    :return: sys_v runlevel
    :rtype: str
    :raise ValueError: when systemd target is unknown
    """
    if target == 'poweroff.target':
        runlevel = '0'
    elif target == 'rescue.target':
        runlevel = 's'
    elif target == 'multi-user.target':
        runlevel = '3'
    elif target == 'graphical.target':
        runlevel = '5'
    elif target == 'reboot.target':
        runlevel = '6'
    else:
        raise ValueError('unknown target %s' % target)
    return runlevel
