parameters: (root)
docstring: Cleanup attributes which are not fit epubcheck requirements
          :param root: lxml.html.HtmlElement
docstring_summary: Cleanup attributes which are not fit epubcheck requirements
          :param root: lxml.html.HtmlElement
docstring_tokens: Cleanup attributes which are not fit epubcheck requirements : param root : lxml . html . HtmlElement
function: def _cleanup_attrs(root):
          """
          Cleanup attributes which are not fit epubcheck requirements
          :param root: lxml.html.HtmlElement
          """
  
          # Check all elements with attr "id" exists
          # XML ID's are not allowed to start with a number!
          for element in root.xpath('//*[@id]'):
              if element.attrib['id'][0].isdigit():
                  del element.attrib['id']
  
          # remove not allowed tags
          # required to fit epubcheck requirements
          for tag, permitted_attrs in EPUB_ALLOWED_TAG_ATTRS:
              for element in root.iter(tag):
                  not_allowed_keys = set(element.attrib.keys()) - set(permitted_attrs)
                  for attr_key in not_allowed_keys:
                      del element.attrib[attr_key]
function_tokens: def _cleanup_attrs ( root ) : # Check all elements with attr "id" exists # XML ID's are not allowed to start with a number! for element in root . xpath ( '//*[@id]' ) : if element . attrib [ 'id' ] [ 0 ] . isdigit ( ) : del element . attrib [ 'id' ] # remove not allowed tags # required to fit epubcheck requirements for tag , permitted_attrs in EPUB_ALLOWED_TAG_ATTRS : for element in root . iter ( tag ) : not_allowed_keys = set ( element . attrib . keys ( ) ) - set ( permitted_attrs ) for attr_key in not_allowed_keys : del element . attrib [ attr_key ]