def __init__(self, type_string: str) -> None:
        self.type_string = type_string
    def __str__(self) -> str:
        return (
            f"Timetable class {self.type_string!r} is not registered or "
            "you have a top level database access that disrupted the session. "
            "Please check the airflow best practices documentation."
        )
def _encode_timetable(var: Timetable) -> dict[str, Any]:
    """Encode a timetable instance.
    This delegates most of the serialization work to the type, so the behavior
    can be completely controlled by a custom subclass.
    """
    timetable_class = type(var)
    importable_string = qualname(timetable_class)
    if _get_registered_timetable(importable_string) is None:
        raise _TimetableNotRegistered(importable_string)
    return {Encoding.TYPE: importable_string, Encoding.VAR: var.serialize()}
def _decode_timetable(var: dict[str, Any]) -> Timetable:
    """Decode a previously serialized timetable.
    Most of the deserialization logic is delegated to the actual type, which
    we import from string.
    """
    importable_string = var[Encoding.TYPE]
    timetable_class = _get_registered_timetable(importable_string)
    if timetable_class is None:
        raise _TimetableNotRegistered(importable_string)
    return timetable_class.deserialize(var[Encoding.VAR])
class _XComRef(NamedTuple):