code: def switch_onoff(self, device, status):
          
          if status == 1 or status == True or status == '1':
              return self.switch_on(device)
          else:
              return self.switch_off(device)
docs: Switch a Socket