code: def is_exact(needle, haystack, start, end, matchnot):
      
      return ((start >= 0 and end < len(haystack) and
               haystack[start:end] == needle) ^ matchnot)
docs: Check exact occurrence of needle in haystack