'Stuff that effects the whole document.
mode -- \'strict_html\'   for HTML 4.01 (default)
\'html\'          alias for \'strict_html\'
\'loose_html\'    to allow some deprecated elements
\'xml\'           to allow arbitrary elements
case -- \'lower\'         element names will be printed in lower case (default)
\'upper\'         they will be printed in upper case
onetags --              list or tuple of valid elements with opening tags only
twotags --              list or tuple of valid elements with both opening and closing tags
these two keyword arguments may be used to select
the set of valid elements in \'xml\' mode
invalid elements will raise appropriate exceptions
separator --            string to place between added elements, defaults to newline
class_ --               a class that will be added to every element if defined'

def __init__(self, mode='strict_html', case='lower', onetags=None, twotags=None, separator='\n', class_=None):

    valid_onetags = ['AREA', 'BASE', 'BR', 'COL', 'FRAME', 'HR', 'IMG', 'INPUT', 'LINK', 'META', 'PARAM']
    valid_twotags = ['A', 'ABBR', 'ACRONYM', 'ADDRESS', 'B', 'BDO', 'BIG', 'BLOCKQUOTE', 'BODY', 'BUTTON', 'CAPTION', 'CITE', 'CODE', 'COLGROUP', 'DD', 'DEL', 'DFN', 'DIV', 'DL', 'DT', 'EM', 'FIELDSET', 'FORM', 'FRAMESET', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HEAD', 'HTML', 'I', 'IFRAME', 'INS', 'KBD', 'LABEL', 'LEGEND', 'LI', 'MAP', 'NOFRAMES', 'NOSCRIPT', 'OBJECT', 'OL', 'OPTGROUP', 'OPTION', 'P', 'PRE', 'Q', 'SAMP', 'SCRIPT', 'SELECT', 'SMALL', 'SPAN', 'STRONG', 'STYLE', 'SUB', 'SUP', 'TABLE', 'TBODY', 'TD', 'TEXTAREA', 'TFOOT', 'TH', 'THEAD', 'TITLE', 'TR', 'TT', 'UL', 'VAR']
    deprecated_onetags = ['BASEFONT', 'ISINDEX']
    deprecated_twotags = ['APPLET', 'CENTER', 'DIR', 'FONT', 'MENU', 'S', 'STRIKE', 'U']
    self.header = []
    self.content = []
    self.footer = []
    self.case = case
    self.separator = separator
    self._full = False
    self.class_ = class_
    if ((mode == 'strict_html') or (mode == 'html')):
        self.onetags = valid_onetags
        self.onetags += map(string.lower, self.onetags)
        self.twotags = valid_twotags
        self.twotags += map(string.lower, self.twotags)
        self.deptags = (deprecated_onetags + deprecated_twotags)
        self.deptags += map(string.lower, self.deptags)
        self.mode = 'strict_html'
    elif (mode == 'loose_html'):
        self.onetags = (valid_onetags + deprecated_onetags)
        self.onetags += map(string.lower, self.onetags)
        self.twotags = (valid_twotags + deprecated_twotags)
        self.twotags += map(string.lower, self.twotags)
        self.mode = mode
    elif (mode == 'xml'):
        if (onetags and twotags):
            self.onetags = onetags
            self.twotags = twotags
        elif ((onetags and (not twotags)) or (twotags and (not onetags))):
            raise CustomizationError()
        else:
            self.onetags = russell()
            self.twotags = russell()
        self.mode = mode
    else:
        raise ModeError(mode)
