def find_nth(haystack, needle, n):
    """Finds the nth occurrence of a substring 'needle' in a larger string 'haystack'."""
    start = haystack.find(needle)
    while start >= 0 and n > 1:
        start = haystack.find(needle, start + len(needle))
        n -= 1
    return start