'Initialize a new DNS Update object.
@param zone: The zone which is being updated.
@type zone: A dns.name.Name or string
@param rdclass: The class of the zone; defaults to dns.rdataclass.IN.
@type rdclass: An int designating the class, or a string whose value
is the name of a class.
@param keyring: The TSIG keyring to use; defaults to None.
@type keyring: dict
@param keyname: The name of the TSIG key to use; defaults to None.
The key must be defined in the keyring.  If a keyring is specified
but a keyname is not, then the key used will be the first key in the
keyring.  Note that the order of keys in a dictionary is not defined,
so applications should supply a keyname when a keyring is used, unless
they know the keyring contains only one key.
@type keyname: dns.name.Name or string
@param keyalgorithm: The TSIG algorithm to use; defaults to
dns.tsig.default_algorithm.  Constants for TSIG algorithms are defined
in dns.tsig, and the currently implemented algorithms are
HMAC_MD5, HMAC_SHA1, HMAC_SHA224, HMAC_SHA256, HMAC_SHA384, and
HMAC_SHA512.
@type keyalgorithm: string'

def __init__(self, zone, rdclass=dns.rdataclass.IN, keyring=None, keyname=None, keyalgorithm=dns.tsig.default_algorithm):

    super(Update, self).__init__()
    self.flags |= dns.opcode.to_flags(dns.opcode.UPDATE)
    if isinstance(zone, string_types):
        zone = dns.name.from_text(zone)
    self.origin = zone
    if isinstance(rdclass, string_types):
        rdclass = dns.rdataclass.from_text(rdclass)
    self.zone_rdclass = rdclass
    self.find_rrset(self.question, self.origin, rdclass, dns.rdatatype.SOA, create=True, force_unique=True)
    if (keyring is not None):
        self.use_tsig(keyring, keyname, algorithm=keyalgorithm)
