code: def insertElementTable(self, token):
          
          element = self.createElement(token)
          if self.openElements[-1].name not in tableInsertModeElements:
              return self.insertElementNormal(token)
          else:
              # We should be in the InTable mode. This means we want to do
              # special magic element rearranging
              parent, insertBefore = self.getTableMisnestedNodePosition()
              if insertBefore is None:
                  parent.appendChild(element)
              else:
                  parent.insertBefore(element, insertBefore)
              self.openElements.append(element)
          return element
docs: Create an element and insert it into the tree