:return: the highest index in values where value is found, or -1

def rfind(values, value):
    """ :return: the highest index in values where value is found, or -1 """

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