def find_index(text, pattern):
    """Return the starting index of the first occurrence of pattern in text,
    or None if not found.
    O(n*m) where n is the length of the pattern and m is the length of the text"""
    assert isinstance(text, str), 'text is not a string: {}'.format(text)
    assert isinstance(pattern, str), 'pattern is not a string: {}'.format(text)


    t_index = 0
    p_index = 0
    if pattern == "":
        return 0
    elif len(pattern) == 1:
        for i, char in enumerate(text):
            if char == pattern:
                return i 

        return None

    while t_index < len(text):
        if text[t_index] == pattern[p_index]:
            if p_index == len(pattern) - 1:
                return t_index - p_index
            p_index += 1
            t_index += 1
        elif text[t_index] != pattern[p_index]:
            if p_index != 0:
                t_index -= p_index - 1
                p_index = 0 
            else:
                t_index += 1 
    return None