def get_exception_message(e):
    """ME ValidationError has compatibility code with py2.6
    that doesn't follow py3 .args interface. This works around that.
    """
    from mongoengine.errors import ValidationError as MEValidationError
    if isinstance(e, MEValidationError) and not e.args:
        return e.message
    else:
        return e.args[0]
