'Create a new HMAC object.
key:       key for the keyed hash object.
msg:       Initial input for the hash, if provided.
digestmod: A module supporting PEP 247.  *OR*
A hashlib constructor returning a new hash object. *OR*
A hash name suitable for hashlib.new().
Defaults to hashlib.md5.
Implicit default to hashlib.md5 is deprecated and will be
removed in Python 3.6.
Note: key and msg must be a bytes or bytearray objects.'

def __init__(self, key, msg=None, digestmod=None):

    if (not isinstance(key, (bytes, bytearray))):
        raise TypeError(('key:    expected    bytes    or    bytearray,    but    got    %r' % type(key).__name__))
    if (digestmod is None):
        _warnings.warn('HMAC()    without    an    explicit    digestmod    argument    is    deprecated.', PendingDeprecationWarning, 2)
        digestmod = _hashlib.md5
    if callable(digestmod):
        self.digest_cons = digestmod
    elif isinstance(digestmod, str):
        self.digest_cons = (lambda d='': _hashlib.new(digestmod, d))
    else:
        self.digest_cons = (lambda d='': digestmod.new(d))
    self.outer = self.digest_cons()
    self.inner = self.digest_cons()
    self.digest_size = self.inner.digest_size
    if hasattr(self.inner, 'block_size'):
        blocksize = self.inner.block_size
        if (blocksize < 16):
            _warnings.warn(('block_size    of    %d    seems    too    small;    using    our    default    of    %d.' % (blocksize, self.blocksize)), RuntimeWarning, 2)
            blocksize = self.blocksize
    else:
        _warnings.warn(('No    block_size    attribute    on    given    digest    object;    Assuming    %d.' % self.blocksize), RuntimeWarning, 2)
        blocksize = self.blocksize
    self.block_size = blocksize
    if (len(key) > blocksize):
        key = self.digest_cons(key).digest()
    key = key.ljust(blocksize, '\x00')
    self.outer.update(key.translate(trans_5C))
    self.inner.update(key.translate(trans_36))
    if (msg is not None):
        self.update(msg)
