code: def _validate_connection(self, action, uuid, key):
          
  
          if uuid not in self._connections:
              self._logger.warn("Received message for device with no connection 0x%X", uuid)
              return None
  
          data = self._connections[uuid]
          if key != data['key']:
              self._logger.warn("Received message for device with incorrect key, uuid=0x%X", uuid)
              return None
  
          return data['connection_id']
docs: Validate that a message received for a device has the right key
  
          If this action is valid the corresponding internal connection id to
          be used with the DeviceManager is returned, otherwise None is returned
          and an invalid message status is published.
  
          Args:
              slug (string): The slug for the device we're trying to connect to
              uuid (int): The uuid corresponding to the slug
              key (string): The key passed in when this device was first connected
                  to
  
          Returns:
              int: if the action is allowed, otherwise None