code: def clean_html(data, full=True, parser=DEFAULT_PARSER):
      
      if full:
          dom_tree = parser.parse(data)
      else:
          dom_tree = parser.parseFragment(data)
      walker = treewalkers.getTreeWalker('dom')
      kwargs = _filter_kwargs()
      stream = TextSanitizer(walker(dom_tree), **kwargs)
      s = serializer.HTMLSerializer(
          omit_optional_tags=False,
          quote_attr_values='always',
      )
      return u''.join(s.serialize(stream))
docs: Cleans HTML from XSS vulnerabilities using html5lib
      If full is False, only the contents inside <body> will be returned (without
      the <body> tags).