def record(cls_def):
    """
    Namedtuple which could inherit from other types.
    >>> from Redy.Magic.Classic import record
    >>> class Interface: pass
    >>> @record
    >>> class S(Interface):
    >>>     name: str
    >>>     addr: str
    >>>     sex : int

    >>> s = S("sam", "I/O", 1)
    """
    annotations = getattr(cls_def, '__annotations__', {})
    typ: type = namedtuple(cls_def.__name__, list(annotations.keys()))
    return cls_def.__class__(cls_def.__name__, (typ, *cls_def.__bases__), dict(cls_def.__dict__))