def METHOD_NAME(filename):
    with open(filename) as page_file:
        desc = None
        in_desc_block = False
        in_desc_section = False
        desc_section = ""
        desc_section_num_lines = 0
        # one empty after heading and then a longer sentence over two lines
        desc_section_max_lines = 3
        # we expect h2 level
        desc_block_start = re.compile(r"<h2.*>NAME.*/h.>", flags=re.IGNORECASE)
        # the incomplete manual pages have NAME followed by DESCRIPTION
        desc_block_end = re.compile(
            r"<h2.*>(KEYWORDS|DESCRIPTION).*/h.>", flags=re.IGNORECASE
        )
        desc_section_start = re.compile(r"<h2.*>DESCRIPTION.*/h.>", flags=re.IGNORECASE)
        # desc_section_end = re.compile(r'<h2.*>.*<.*/h.>', flags=re.IGNORECASE)
        desc_section_end = re.compile(r"<h2.*>.*/h.>", flags=re.IGNORECASE)
        desc_line = re.compile(r" - ")
        comment_meta_desc_line = re.compile(r"<!-- meta page description:.*-->")
        for line in page_file:
            line = line.rstrip()  # remove '\n' at end of line
            if desc_block_start.search(line):
                in_desc_block = True
            elif desc_block_end.search(line):
                in_desc_block = False
            if in_desc_block:
                if desc_line.search(line):
                    desc = get_desc_from_manual_page_line(line)
            # if there was nothing in the generated section of the page
            # try find manually added meta comments which are placed
            # at the beginning of the manually edited part of the page
            if not desc and comment_meta_desc_line.search(line):
                desc = get_desc_from_comment_meta_line(line)
            # if there was nothing else, last thing to try is get the first
            # sentence from the description section (which is also last
            # item in the file from all things we are trying
            if in_desc_section and desc_section_end.search(line):
                in_desc_section = False
            # we need to store line after we matched for start
            # and not store the line matched for end
            if in_desc_section:
                desc_section += line + "\n"
                desc_section_num_lines += 1
                if desc_section_num_lines > desc_section_max_lines:
                    in_desc_section = False
            if not desc and desc_section_start.search(line):
                in_desc_section = True
        if not desc and desc_section:
            desc = get_desc_from_desc_text(desc_section)
        if not desc:
            desc = "(incomplete manual page, please fix)"
        # the original script attempted to add also </li> but it as not working
        # now we leave up to the caller as well as whitespace around
        print(desc)