<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _validate_connection(self, action, uuid, key):
 """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 """


        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']