'Adds a new control to the form.
This is usually called by ParseFile and ParseResponse.  Don\'t call it
youself unless you\'re building your own Control instances.
Note that controls representing lists of items are built up from
controls holding only a single list item.  See ListControl.__doc__ for
further information.
type: type of control (see Control.__doc__ for a list)
attrs: HTML attributes of control
ignore_unknown: if true, use a dummy Control instance for controls of
unknown type; otherwise, use a TextControl
select_default: for RADIO and multiple-selection SELECT controls, pick
the first item as the default if no \'selected\' HTML attribute is
present (this defaulting happens when the HTMLForm.fixup method is
called)
index: index of corresponding element in HTML (see
MoreFormTests.test_interspersed_controls for motivation)'

def new_control(self, type, name, attrs, ignore_unknown=False, select_default=False, index=None):

    type = type.lower()
    klass = self.type2class.get(type)
    if (klass is None):
        if ignore_unknown:
            klass = IgnoreControl
        else:
            klass = TextControl
    a = attrs.copy()
    if issubclass(klass, ListControl):
        control = klass(type, name, a, select_default, index)
    else:
        control = klass(type, name, a, index)
    if ((type == 'select') and (len(attrs) == 1)):
        for ii in xrange((len(self.controls) - 1), (-1), (-1)):
            ctl = self.controls[ii]
            if (ctl.type == 'select'):
                ctl.close_control()
                break
    control.add_to_form(self)
    control._urlparse = self._urlparse
    control._urlunparse = self._urlunparse
