'Returns the index of the given value'

def index_of(self, value):

    if self.sort_asc:
        redis_rank_fn = self.redis.zrank
    else:
        redis_rank_fn = self.redis.zrevrank
    key = self.get_key()
    result = redis_rank_fn(key, value)
    if result:
        result = int(result)
    elif (result is None):
        raise ValueError(('Couldnt    find    item    with    value    %s    in    key    %s' % (value, key)))
    return result
