Akamai edge logic may need to detect a token in a request path before applying a Property Manager rule. Given a text string and a pattern string, return the index of the pattern's first occurrence in the text, or -1 if it does not occur.
Implement the search without using Python's built-in substring search methods. Your solution should preprocess the pattern so repeated prefixes are not rescanned.
Implement find_token(text, pattern):
text and pattern.pattern begins in text, or -1 when no match exists.0, following standard substring-search conventions.def find_token(text, pattern):