def _get_consistent_error_message(error):
    """Returns error messages consistent across Python 2 and 3.

    jsonschema uses repr() to print its error messages, which means strings
    will render as "u'...'" in Python 2 and "'...'" in Python 3, making
    testing for error messages unnecessarily difficult.
    """
    if error.validator == 'type':
        return "'{}' is not of type '{}'".format(error.instance, error.
            validator_value)
    elif error.validator == 'enum':
        return "'{}' is not one of ['{}']".format(error.instance, "','".
            join(error.validator_value))
    elif error.validator == 'required':
        if error.message[0:2] == "u'":
            return error.message[1:]
    return error.message
