def get_unit_status(code):
 output = check_output(('heyu onstate ' + code), shell=True)
 return int(output.decode('utf-8')[0])

def get_unit_status ( code ) : output = check_output ( ( 'heyu onstate ' + code ) , shell = True ) return int ( output . decode ( 'utf-8' ) [ 0 ] )
get on/off status for given unit .