def find_string_in_file(mmFile, filePath, targetString):
    """wrapper that raises error if no substr can be found
    finds the last occurrence of a substring in memory mapped file
    """
    location = mmFile.find(targetString.encode(encoding='utf-8'))
    if location == -1:
        s = 'It seems "{:s}" was not present in the file\n' + """"{:s}"
Check that the previous calculation didn't fail"""
        raise Exception(s.format(targetString, filePath))
    return location
