def rindex(values, value):
    """ :return: the highest index in values where value is found, else raise ValueError """

    if isinstance(values, STRING_TYPES):
        try:
            return values.rindex(value)
        except TypeError:
            # Python 3 compliance: search for str values in bytearray
            return values.rindex(type(values)(value, DEFAULT_ENCODING))
    else:
        return len(values) - 1 - values[::-1].index(value)
:return: the highest index in values where value is found, else raise ValueError