def METHOD_NAME(lvl, line):
    index = levels.index(lvl)
    needed = "|".join(levels[:index + 1])
    regex = r"^\S+\s+\d+\s+\d+:\d+:\d+(\.\d+){{0,1}}\s+\S+\s+({})\s+"
    cre = re.compile(regex.format(needed.upper()))
    return cre.search(line)