@_ensure_exists
def state(name):
 try:
  cmd = 'show {0} --property=State'.format(name)
  return _machinectl(cmd, ignore_retcode=True)['stdout'].split('=')[(-1)]
 except IndexError:
  return 'stopped'

@ _ensure_exists def state ( name ) : try : cmd = 'show {0} --property=State' . format ( name ) return _machinectl ( cmd , ignore_retcode = True ) [ 'stdout' ] . split ( '=' ) [ ( - 1 ) ] except IndexError : return 'stopped'
returns the state of a container .