def from_xfr(xfr, zone_factory=Zone, relativize=True, check_origin=True):
 z = None
 for r in xfr:
  if (z is None):
   if relativize:
    origin = r.origin
   else:
    origin = r.answer[0].name
   rdclass = r.answer[0].rdclass
   z = zone_factory(origin, rdclass, relativize=relativize)
  for rrset in r.answer:
   znode = z.nodes.get(rrset.name)
   if (not znode):
    znode = z.node_factory()
    z.nodes[rrset.name] = znode
   zrds = znode.find_rdataset(rrset.rdclass, rrset.rdtype, rrset.covers, True)
   zrds.update_ttl(rrset.ttl)
   for rd in rrset:
    rd.choose_relativity(z.origin, relativize)
    zrds.add(rd)
 if check_origin:
  z.check_origin()
 return z

def from_xfr ( xfr , zone_factory = Zone , relativize = True , check_origin = True ) : z = None for r in xfr : if ( z is None ) : if relativize : origin = r . origin else : origin = r . answer [ 0 ] . name rdclass = r . answer [ 0 ] . rdclass z = zone_factory ( origin , rdclass , relativize = relativize ) for rrset in r . answer : znode = z . nodes . get ( rrset . name ) if ( not znode ) : znode = z . node_factory ( ) z . nodes [ rrset . name ] = znode zrds = znode . find_rdataset ( rrset . rdclass , rrset . rdtype , rrset . covers , True ) zrds . update_ttl ( rrset . ttl ) for rd in rrset : rd . choose_relativity ( z . origin , relativize ) zrds . add ( rd ) if check_origin : z . check_origin ( ) return z
convert the output of a zone transfer generator into a zone object .