def find_nth(str1, mystr, n):
    """ Finds a pattern in an input string and returns the starting index. """

    start = str1.find(mystr)
    while start >= 0 and n > 1:
        start = str1.find(mystr, start+len(mystr))
        n -=1
    return start