def error(self, key, **kwargs):
        """
        A helper method that simply raises a validation error.
        """
        try:
            msg = self.error_messages[key]
        except KeyError:
            class_name = self.__class__.__name__
            raise AssertionError('Error with key={} is not found for class={}'.format(key, class_name))
        message_string = msg.format(**kwargs)
        raise ValidationError(message_string, code=key)

        A helper method that simply raises a validation error.
        
packages/jet_bridge_base/jet_bridge_base/fields/field.py