def find_index(text, pattern, start_index=0):
    """Return the starting index of the first occurrence of pattern in text,
    or None if not found.
    Running time: 0(t * p) for t characters in the text and p characters in the
    pattern. For every character in the text we always loop through the whole pattern.
    Space: 0(1)"""
    assert isinstance(text, str), 'text is not a string: {}'.format(text)
    assert isinstance(pattern, str), 'pattern is not a string: {}'.format(text)
    if pattern == '':
        return 0
    # Before we check the text and pattern lets make sure the pattern occurs in the text
    for t_index in range(start_index, len(text)): # 0(t)
        for p_index, p_char in enumerate(pattern): # Always p iterations because no early exit
            # check if more characters in the text match characters in the pattern
            text_char = text[t_index + p_index]
            # check if letters are the same
            if text_char == p_char:
                continue
            # they are not the same
            else:
                break
        else:                                                                     # Really helpful resource to find solution: https://www.python-course.eu/python3_for_loop.php
            # all characters in the pattern matched in the text
            return t_index

    # tried all possible starting indexes in text, never found a perfect match
    return None