def title_tag_inspected(tag, parent_tag_name=None, p_parent_tag_name=None, direct_sibling_only=False):
title_tag = None<EOL>if direct_sibling_only is True:<EOL><INDENT>for sibling_tag in tag:<EOL><INDENT>if sibling_tag.name and sibling_tag.name == "<STR_LIT:title>":<EOL><INDENT>title_tag = sibling_tag<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>title_tag = raw_parser.title(tag)<EOL><DEDENT>if parent_tag_name and p_parent_tag_name:<EOL><INDENT>if (title_tag and title_tag.parent.name and title_tag.parent.parent.name<EOL>and title_tag.parent.name == parent_tag_name<EOL>and title_tag.parent.parent.name == p_parent_tag_name):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>title_tag = None<EOL><DEDENT><DEDENT>return title_tag<EOL>
Extract the title tag and sometimes inspect its parents