def validate(self, msg):
        _model = {
            'id': '',
            'collection': '',
            'action': '',
            'attributes': {},
            'monitor': False
        }

        try:
            msg = json.loads(msg)
            _model.update(msg)
        except AttributeError as err:
            raise ValueError("Message not well formatted: %s", err)

        if 'collection' not in msg or not msg['collection']:
            raise ValueError("Collection missing.")

        if msg not in 'action' or not msg['action']:
            raise ValueError("Action missing.")

        if 'attributes' in msg and not isinstance(msg['attributes'], dict):
            raise ValueError("Attributes must be a dict.")

        if 'monitor' in msg and not isinstance(msg['monitor'], bool):
            raise ValueError("Monitor must be a boolean")

        return _model
dataset/ETHPy150Open comodit/synapse-agent/synapse/task.py/IncomingMessage.validate/swapped operands of `not in`