def METHOD_NAME(
    cls: T, dpt_main: int, dpt_sub: int | None = None
) -> T | None:
    """Return Class reference of DPTBase subclass with matching DPT number."""
    for dpt in cls.dpt_class_tree():
        if dpt.has_distinct_dpt_numbers():
            if dpt_main == dpt.dpt_main_number and dpt_sub == dpt.dpt_sub_number:
                return dpt
    return None