code: def new_control(self, type, name, value, **kwargs):
          
          old_input = self.form.find_all('input', {'name': name})
          for old in old_input:
              old.decompose()
          old_textarea = self.form.find_all('textarea', {'name': name})
          for old in old_textarea:
              old.decompose()
          # We don't have access to the original soup object (just the
          # Tag), so we instantiate a new BeautifulSoup() to call
          # new_tag(). We're only building the soup object, not parsing
          # anything, so the parser doesn't matter. Specify the one
          # included in Python to avoid having dependency issue.
          control = BeautifulSoup("", "html.parser").new_tag('input')
          control['type'] = type
          control['name'] = name
          control['value'] = value
          for k, v in kwargs.items():
              control[k] = v
          self.form.append(control)
          return control
docs: Add a new input element to the form.
  
          The arguments set the attributes of the new element.