def validate_operation(self, operation: cirq.Operation):
        """Raises an error if the given operation is invalid on this device.

        Args:
            operation: The operation to validate.

        Raises:
            ValueError: If the operation is not valid.
            NotImplementedError: If the operation is a measurement with an invert
                mask.
        """

        if not isinstance(operation, cirq.GateOperation):
            raise ValueError("Unsupported operation")

        if not self.is_pasqal_device_op(operation):
            raise ValueError(f'{operation.gate!r} is not a supported gate')

        for qub in operation.qubits:
            if not isinstance(qub, self.supported_qubit_type):
                raise ValueError(
                    f'{qub} is not a valid qubit for gate {operation.gate!r}. This '
                    f'device accepts gates on qubits of type: '
                    f'{self.supported_qubit_type}'
                )
            if qub not in self.metadata.qubit_set:
                raise ValueError(f'{qub} is not part of the device.')

        if isinstance(operation.gate, cirq.MeasurementGate):
            if operation.gate.invert_mask != ():
                raise NotImplementedError(
                    "Measurements on Pasqal devices don't support invert_mask."
                )
Raises an error if the given operation is invalid on this device.

        Args:
            operation: The operation to validate.

        Raises:
            ValueError: If the operation is not valid.
            NotImplementedError: If the operation is a measurement with an invert
                mask.
        
cirq-pasqal/cirq_pasqal/pasqal_device.py