code: def is_mainline(self) -> bool:
          
          node = self
  
          while node.parent:
              parent = node.parent
  
              if not parent.variations or parent.variations[0] != node:
                  return False
  
              node = parent
  
          return True
docs: Checks if the node is in the mainline of the game.