code: def _publish_scan_response(self, client):
          
  
          devices = self._manager.scanned_devices
  
          converted_devs = []
          for uuid, info in devices.items():
              slug = self._build_device_slug(uuid)
  
              message = {}
              message['uuid'] = uuid
              if uuid in self._connections:
                  message['user_connected'] = True
              elif 'user_connected' in info:
                  message['user_connected'] = info['user_connected']
              else:
                  message['user_connected'] = False
  
              message['connection_string'] = slug
              message['signal_strength'] = info['signal_strength']
  
              converted_devs.append({x: y for x, y in message.items()})
              message['type'] = 'notification'
              message['operation'] = 'advertisement'
  
              self.client.publish(self.topics.gateway_topic(slug, 'data/advertisement'), message)
  
          probe_message = {}
          probe_message['type'] = 'response'
          probe_message['client'] = client
          probe_message['success'] = True
          probe_message['devices'] = converted_devs
  
          self.client.publish(self.topics.status, probe_message)
docs: Publish a scan response message
  
          The message contains all of the devices that are currently known
          to this agent.  Connection strings for direct connections are
          translated to what is appropriate for this agent.
  
          Args:
              client (string): A unique id for the client that made this request