def convert_sysv_runlevel(level):
 runlevel = str(level)
 if (runlevel == '0'):
  target = 'poweroff.target'
 elif (runlevel in ['1', 's', 'single']):
  target = 'rescue.target'
 elif (runlevel in ['2', '3', '4']):
  target = 'multi-user.target'
 elif (runlevel == '5'):
  target = 'graphical.target'
 elif (runlevel == '6'):
  target = 'reboot.target'
 else:
  raise ValueError(('unknown runlevel %s' % level))
 return target

def convert_sysv_runlevel ( level ) : runlevel = str ( level ) if ( runlevel == '0' ) : target = 'poweroff.target' elif ( runlevel in [ '1' , 's' , 'single' ] ) : target = 'rescue.target' elif ( runlevel in [ '2' , '3' , '4' ] ) : target = 'multi-user.target' elif ( runlevel == '5' ) : target = 'graphical.target' elif ( runlevel == '6' ) : target = 'reboot.target' else : raise ValueError ( ( 'unknown runlevel %s' % level ) ) return target
convert runlevel to systemd target .