'Create a MIME-compliant header that can contain many character sets.
Optional s is the initial header value.  If None, the initial header
value is not set.  You can later append to the header with .append()
method calls.  s may be a byte string or a Unicode string, but see the
.append() documentation for semantics.
Optional charset serves two purposes: it has the same meaning as the
charset argument to the .append() method.  It also sets the default
character set for all subsequent .append() calls that omit the charset
argument.  If charset is not provided in the constructor, the us-ascii
charset is used both as s\'s initial charset and as the default for
subsequent .append() calls.
The maximum line length can be specified explicit via maxlinelen.  For
splitting the first line to a shorter value (to account for the field
header which isn\'t included in s, e.g. `Subject\') pass in the name of
the field in header_name.  The default maxlinelen is 76.
continuation_ws must be RFC 2822 compliant folding whitespace (usually
either a space or a hard tab) which will be prepended to continuation
lines.
errors is passed through to the .append() call.'

def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, continuation_ws='    ', errors='strict'):

    if (charset is None):
        charset = USASCII
    if (not isinstance(charset, Charset)):
        charset = Charset(charset)
    self._charset = charset
    self._continuation_ws = continuation_ws
    cws_expanded_len = len(continuation_ws.replace(' DCTB ', SPACE8))
    self._chunks = []
    if (s is not None):
        self.append(s, charset, errors)
    if (maxlinelen is None):
        maxlinelen = MAXLINELEN
    if (header_name is None):
        self._firstlinelen = maxlinelen
    else:
        self._firstlinelen = ((maxlinelen - len(header_name)) - 2)
    self._maxlinelen = (maxlinelen - cws_expanded_len)
    return
