def extract_component_doi(tag, nodenames):
component_doi = None<EOL>if(tag.name == "<STR_LIT>"):<EOL><INDENT>component_doi = doi_uri_to_doi(node_text(first(raw_parser.article_id(tag, pub_id_type= "<STR_LIT>"))))<EOL><DEDENT>else:<EOL><INDENT>object_id_tag = first(raw_parser.object_id(tag, pub_id_type= "<STR_LIT>"))<EOL>if tag.name == "<STR_LIT>" and not object_id_tag:<EOL><INDENT>component_doi = None<EOL><DEDENT>else:<EOL><INDENT>if object_id_tag and first_parent(object_id_tag, nodenames).name == tag.name:<EOL><INDENT>component_doi = doi_uri_to_doi(node_text(object_id_tag))<EOL><DEDENT><DEDENT><DEDENT>return component_doi<EOL>
Used to get component DOI from a tag and confirm it is actually for that tag
and it is not for one of its children in the list of nodenames