'When sending, a TSIG signature using the specified keyring
and keyname should be added.
@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 fudge: TSIG time fudge; default is 300 seconds.
@type fudge: int
@param original_id: TSIG original id; defaults to the message\'s id
@type original_id: int
@param tsig_error: TSIG error code; default is 0.
@type tsig_error: int
@param other_data: TSIG other data.
@type other_data: string
@param algorithm: The TSIG algorithm to use; defaults to
dns.tsig.default_algorithm'

def use_tsig(self, keyring, keyname=None, fudge=300, original_id=None, tsig_error=0, other_data='', algorithm=dns.tsig.default_algorithm):

    self.keyring = keyring
    if (keyname is None):
        self.keyname = list(self.keyring.keys())[0]
    else:
        if isinstance(keyname, string_types):
            keyname = dns.name.from_text(keyname)
        self.keyname = keyname
    self.keyalgorithm = algorithm
    self.fudge = fudge
    if (original_id is None):
        self.original_id = self.id
    else:
        self.original_id = original_id
    self.tsig_error = tsig_error
    self.other_data = other_data
