'Extended header setting.
_name is the header field to add.  keyword arguments can be used to set
additional parameters for the header field, with underscores converted
to dashes.  Normally the parameter will be added as key="value" unless
value is None, in which case only the key will be added.
Example:
h.add_header(\'content-disposition\', \'attachment\', filename=\'bud.gif\')
Note that unlike the corresponding \'email.message\' method, this does
*not* handle \'(charset, language, value)\' tuples: all values must be
strings or None.'

def add_header(self, _name, _value, **_params):

    parts = []
    if (_value is not None):
        parts.append(_value)
    for (k, v) in _params.items():
        if (v is None):
            parts.append(k.replace('_', '-'))
        else:
            parts.append(_formatparam(k.replace('_', '-'), v))
    self._headers.append((_name, ';    '.join(parts)))
