def find_all_indexes(text, pattern, flag = False):
    """Return a list of starting indexes of all occurrences of pattern in text,
    or an empty list if not found."""
    assert isinstance(text, str), 'text is not a string: {}'.format(text)
    assert isinstance(pattern, str), 'pattern is not a string: {}'.format(text)
    # have list to store indexes
    all_indexes = []
    if pattern == "":
        for i in range(len(text)):
            all_indexes.append(i)
        return all_indexes
    #loops through all indexes
    for text_index in range(len(text)):
        letter = text[text_index]

        if len(text) - text_index < len(pattern):
            return all_indexes

        if letter == pattern[0]:
            # keep checking rest of pattern
            for pattern_index in range(len(pattern)):
                if pattern[pattern_index] != text[text_index + pattern_index]:
                    break
                if pattern_index == len(pattern) - 1:
                    all_indexes.append(text_index)
    return all_indexes