def _parse_figure(self, node, state):
if node.tag not in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>return state<EOL><DEDENT>stable_id = (<EOL>f"<STR_LIT>"<EOL>f"<STR_LIT>"<EOL>f"<STR_LIT>"<EOL>f"<STR_LIT::>"<EOL>f"<STR_LIT>"<EOL>)<EOL>name = node.attrib["<STR_LIT:name>"] if "<STR_LIT:name>" in node.attrib else None<EOL>if node.tag == "<STR_LIT>" and isinstance(state["<STR_LIT>"][node], Figure):<EOL><INDENT>return state<EOL><DEDENT>parts = {}<EOL>parent = state["<STR_LIT>"][node]<EOL>if isinstance(parent, Section):<EOL><INDENT>parts["<STR_LIT>"] = parent<EOL><DEDENT>elif isinstance(parent, Cell):<EOL><INDENT>parts["<STR_LIT>"] = parent.table.section<EOL>parts["<STR_LIT>"] = parent<EOL><DEDENT>else:<EOL><INDENT>logger.warning(f"<STR_LIT>")<EOL>return state<EOL><DEDENT>parts["<STR_LIT>"] = state["<STR_LIT>"]<EOL>parts["<STR_LIT>"] = stable_id<EOL>parts["<STR_LIT:name>"] = name<EOL>parts["<STR_LIT>"] = state["<STR_LIT>"]["<STR_LIT>"]<EOL>if node.tag == "<STR_LIT>":<EOL><INDENT>parts["<STR_LIT:url>"] = node.get("<STR_LIT:src>")<EOL>state["<STR_LIT>"][node] = Figure(**parts)<EOL><DEDENT>elif node.tag == "<STR_LIT>":<EOL><INDENT>imgs = [child for child in node if child.tag == "<STR_LIT>"]<EOL>if len(imgs) > <NUM_LIT:1>:<EOL><INDENT>logger.warning("<STR_LIT>")<EOL>captions = [child for child in node if child.tag == "<STR_LIT>"]<EOL>state["<STR_LIT>"].update(captions)<EOL>return state<EOL><DEDENT>img = imgs[<NUM_LIT:0>]<EOL>state["<STR_LIT>"].add(img)<EOL>parts["<STR_LIT:url>"] = img.get("<STR_LIT:src>")<EOL>state["<STR_LIT>"][node] = Figure(**parts)<EOL><DEDENT>state["<STR_LIT>"]["<STR_LIT>"] += <NUM_LIT:1><EOL>return state<EOL>
Parse the figure node.

        :param node: The lxml img node to parse
        :param state: The global state necessary to place the node in context
            of the document as a whole.