+ def generate_rr(self, owner: str, zone: 'Zone') -> 'Any':
+ return zone.RR(owner, 'NS', zone.abs_hostname(self._name))
+
+
+class DS:
+ def __init__(self, tag: int, alg: int, digest: int, key: str) -> None:
+ self._tag = int(tag)
+ self._key = check_hex(key)
+ self._alg = int(alg)
+ self._digest = int(digest)
+
+ def generate_rr(self, owner: str, zone: 'Zone') -> 'Any':
+ return zone.RR(owner, 'DS', '{0} {1} {2} {3}'.format(self._tag, self._alg, self._digest, self._key))
+
+## Higher-level classes
+class Name:
+ def __init__(self, *records: 'List[Any]') -> None:
+ self._records = records
+
+ def generate_rrs(self, owner: str, zone: 'Zone') -> 'Iterator':
+ for record in self._records:
+ # this could still be a list
+ if isinstance(record, list):
+ for subrecord in record:
+ yield subrecord.generate_rr(owner, zone)
+ else:
+ yield record.generate_rr(owner, zone)
+
+
+def CName(name: str) -> Name:
+ return Name(CNAME(name))
+
+
+def Delegation(name: str) -> Name:
+ return Name(NS(name))
+
+
+def SecureDelegation(name: str, tag: int, alg: int, digest: int, key: str) -> Name:
+ return Name(NS(name), DS(tag, alg, digest, key))
+