code: async def _poll_gpio(self, poll, interval=10):
          
          if poll and self._gpio_task is None:
              async def polling_routine(interval):
                  """Poll GPIO state every @interval seconds."""
                  while True:
                      try:
                          pios = None
                          ret = await self._wait_for_cmd(
                              OTGW_CMD_REPORT, OTGW_REPORT_GPIO_STATES)
                          if ret:
                              pios = ret[2:]
                              status = {
                                  OTGW_GPIO_A_STATE: int(pios[0]),
                                  OTGW_GPIO_B_STATE: int(pios[1]),
                              }
                              self._update_status(status)
                          await asyncio.sleep(interval)
                      except asyncio.CancelledError:
                          status = {
                              OTGW_GPIO_A_STATE: 0,
                              OTGW_GPIO_B_STATE: 0,
                          }
                          self._update_status(status)
                          self._gpio_task = None
                          break
              self._gpio_task = self.loop.create_task(polling_routine(interval))
          elif not poll and self._gpio_task is not None:
              self._gpio_task.cancel()
docs: Start or stop polling GPIO states.
  
          GPIO states aren't being pushed by the gateway, we need to poll
          if we want updates.