def hostedzone_from_element(zone):
    """
    Construct a L{HostedZone} instance from a I{HostedZone} XML element.
    """
    return HostedZone(
        name=maybe_bytes_to_unicode(zone.find("Name").text).encode("ascii").decode("idna"),
        identifier=maybe_bytes_to_unicode(zone.find("Id").text).replace(u"/hostedzone/", u""),
        rrset_count=int(zone.find("ResourceRecordSetCount").text),
        reference=maybe_bytes_to_unicode(zone.find("CallerReference").text),
    )
Construct a L{HostedZone} instance from a I{HostedZone} XML element.