find_index for first occurrence of pattern in text
Python is a duck typed language, so it's not considered normal to assert instance types. Instead simply assume that the user passed a string, and let the program fail if the input can't be processed sensibly.

You calculate the length of text and pattern potentially many times during a run. Unless you plan on modifying them during the run you can save the results to a variable and reuse that.

You can get rid of if text_index + i &lt; len(text) by changing your while statement to take into account the length of the pattern.

Apropos runtime: I'm purposefully not commenting on more advanced algorithms for text searching, mainly because I don't memorize things I have literally never had to use.