def indexesof(l, fn, opposite=0):
    """indexesof(l, fn) -> list of indexes

    Return a list of indexes i where fn(l[i]) is true.

    """
    indexes = []
    for i in range(len(l)):
        f = fn(l[i])
        if (not opposite and f) or (opposite and not f):
            indexes.append(i)
    return indexes