def METHOD_NAME(filename, text):
    filelist = glob.glob(filename)
    for file in filelist:
        with open(file, 'r') as ifile:
            magtext = ifile.read().splitlines() 
        sectionrex = re.compile('<< ')
        labelsrex = re.compile('<< labels >>')
        in_labels = False
        ignore = False
        watch = False
        with open(file, 'w') as ofile:
            for line in magtext:
                watch = True if ignore else False
                ignore = False
                lmatch = labelsrex.match(line)
                if lmatch:
                    in_labels = True
                elif in_labels:
                    smatch = sectionrex.match(line)
                    if smatch:
                        in_labels = False
                    else:
                        label = line.split()[-1]
                        if fnmatch.fnmatch(label, text):
                            ignore = True
                        elif watch:
                            if line.startswith('port'):
                                ignore = True
                if not ignore:
                    print(line, file=ofile)