def findall(text, pattern):
    """Returns list of all offsets of pattern in text"""
    start = 0
    offsets = []
    while True:
        ofs = text.find(pattern, start)
        if ofs < 0:
            return offsets
        offsets.append(ofs)
        start = ofs + 1