def getTableMisnestedNodePosition(self):
<EOL>lastTable = None<EOL>fosterParent = None<EOL>insertBefore = None<EOL>for elm in self.openElements[::-<NUM_LIT:1>]:<EOL><INDENT>if elm.name == "<STR_LIT>":<EOL><INDENT>lastTable = elm<EOL>break<EOL><DEDENT><DEDENT>if lastTable:<EOL><INDENT>if lastTable.parent:<EOL><INDENT>fosterParent = lastTable.parent<EOL>insertBefore = lastTable<EOL><DEDENT>else:<EOL><INDENT>fosterParent = self.openElements[<EOL>self.openElements.index(lastTable) - <NUM_LIT:1>]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>fosterParent = self.openElements[<NUM_LIT:0>]<EOL><DEDENT>return fosterParent, insertBefore<EOL>
Get the foster parent element, and sibling to insert before
        (or None) when inserting a misnested table node