code: def _create_get_state_request(self, given_devices):
          
          dev_list = []
  
          if isinstance(given_devices, list):
              devices = given_devices
          else:
              devices = []
              for dev_name, item in self.__devices.items():
                  if item:
                      devices.append(self.__devices[dev_name])
  
          for device in devices:
              states = []
  
              for state_name in sorted(device.active_states.keys()):
                  states.append({'name': state_name})
  
              dev_list.append({'deviceURL': device.url, 'states': states})
  
          return json.dumps(
              dev_list, indent=None,
              sort_keys=True, separators=(',', ': '))
docs: Create state request.