code: def checkform (form, env):
      
      # check lang support
      if "language" in form:
          lang = formvalue(form, 'language')
          if lang in _supported_langs:
              localestr = lang_locale[lang]
              try:
                  # XXX this is not thread-safe, so think of something else
                  locale.setlocale(locale.LC_ALL, localestr)
                  init_i18n()
              except locale.Error as errmsg:
                  log(env, "could not set locale %r: %s" % (localestr, errmsg))
          else:
              raise LCFormError(_("unsupported language %r") % lang)
      # check url syntax
      if "url" in form:
          url = formvalue(form, "url")
          if not url or url == "http://":
              raise LCFormError(_("empty url was given"))
          if not urlutil.is_safe_url(url):
              raise LCFormError(_("disallowed url %r was given") % url)
      else:
          raise LCFormError(_("no url was given"))
      # check recursion level
      if "level" in form:
          level = formvalue(form, "level")
          if not _is_level(level):
              raise LCFormError(_("invalid recursion level %r") % level)
      # check options
      for option in ("anchors", "errors", "intern"):
          if option in form:
              value = formvalue(form, option)
              if value != "on":
                  raise LCFormError(_("invalid %s option %r") % (option, value))
docs: Check form data. throw exception on error
      Be sure to NOT print out any user-given data as HTML code, so use
      only plain strings as exception text.