code: def test_joined_inheritance_multilevel(self):
      class BaseClass(Versioned, self.Base, ComparableEntity):
          __tablename__ = "basetable"
  
          id = Column(Integer, primary_key=True)
          name = Column(String(50))
          type = Column(String(20))
  
          __mapper_args__ = {
              "polymorphic_on": type,
              "polymorphic_identity": "base",
          }
  
      class SubClass(BaseClass):
          __tablename__ = "subtable"
  
          id = column_property(
              Column(Integer, primary_key=True), BaseClass.id
          )
          base_id = Column(Integer, ForeignKey("basetable.id"))
          subdata1 = Column(String(50))
  
          __mapper_args__ = {"polymorphic_identity": "sub"}
  
      class SubSubClass(SubClass):
          __tablename__ = "subsubtable"
  
          id = Column(
              Integer, ForeignKey("subtable.id"), primary_key=True
          )
          subdata2 = Column(String(50))
  
          __mapper_args__ = {"polymorphic_identity": "subsub"}
  
      self.create_tables()
  
      SubSubHistory = SubSubClass.__history_mapper__.class_
      sess = self.session
      q = sess.query(SubSubHistory)
      self.assert_compile(
          q,
          "SELECT "
          "basetable_history.name AS basetable_history_name, "
          "basetable_history.type AS basetable_history_type, "
          "subsubtable_history.version AS subsubtable_history_version, "
          "subtable_history.version AS subtable_history_version, "
          "basetable_history.version AS basetable_history_version, "
          "subtable_history.base_id AS subtable_history_base_id, "
          "subtable_history.subdata1 AS subtable_history_subdata1, "
          "subsubtable_history.id AS subsubtable_history_id, "
          "subtable_history.id AS subtable_history_id, "
          "basetable_history.id AS basetable_history_id, "
          "subsubtable_history.changed AS subsubtable_history_changed, "
          "subtable_history.changed AS subtable_history_changed, "
          "basetable_history.changed AS basetable_history_changed, "
          "subsubtable_history.subdata2 AS subsubtable_history_subdata2 "
          "FROM basetable_history "
          "JOIN subtable_history "
          "ON basetable_history.id = subtable_history.base_id "
          "AND basetable_history.version = subtable_history.version "
          "JOIN subsubtable_history ON subtable_history.id = "
          "subsubtable_history.id AND subtable_history.version = "
          "subsubtable_history.version",
      )
  
      ssc = SubSubClass(name="ss1", subdata1="sd1", subdata2="sd2")
      sess.add(ssc)
      sess.commit()
      eq_(sess.query(SubSubHistory).all(), [])
      ssc.subdata1 = "sd11"
      ssc.subdata2 = "sd22"
      sess.commit()
      eq_(
          sess.query(SubSubHistory).all(),
          [
              SubSubHistory(
                  name="ss1",
                  subdata1="sd1",
                  subdata2="sd2",
                  type="subsub",
                  version=1,
              )
          ],
      )
      eq_(
          ssc,
          SubSubClass(
              name="ss1", subdata1="sd11", subdata2="sd22", version=2
          ),
      )
  
imports: import unittest
  import warnings
  from sqlalchemy import Boolean
  from sqlalchemy import Column
  from sqlalchemy import create_engine
  from sqlalchemy import ForeignKey
  from sqlalchemy import inspect
  from sqlalchemy import Integer
  from sqlalchemy import join
  from sqlalchemy import select
  from sqlalchemy import String
  from sqlalchemy.orm import clear_mappers
  from sqlalchemy.orm import column_property
  from sqlalchemy.orm import declarative_base
  from sqlalchemy.orm import DeclarativeBase
  from sqlalchemy.orm import deferred
  from sqlalchemy.orm import exc
  from sqlalchemy.orm import relationship
  from sqlalchemy.orm import Session
  from sqlalchemy.testing import assert_raises
  from sqlalchemy.testing import AssertsCompiledSQL
  from sqlalchemy.testing import eq_
  from sqlalchemy.testing import eq_ignore_whitespace
  from sqlalchemy.testing import is_
  from sqlalchemy.testing import ne_
  from sqlalchemy.testing.entities import ComparableEntity
  from .history_meta import Versioned
  from .history_meta import versioned_session
label_desc: Use image node_id 12 for calling the TestVersioning obj's underlying member method code with example usage: obj.test_joined_inheritance_multilevel() without return types