def html_serialize(self, attributes, max_length=None):
doc = ET.Element('<STR_LIT>')<EOL>for chunk in self:<EOL><INDENT>if (chunk.has_cjk() and<EOL>not (max_length and len(chunk.word) > max_length)):<EOL><INDENT>ele = ET.Element('<STR_LIT>')<EOL>ele.text = chunk.word<EOL>for key, val in attributes.items():<EOL><INDENT>ele.attrib[key] = val<EOL><DEDENT>doc.append(ele)<EOL><DEDENT>else:<EOL><INDENT>if doc.getchildren():<EOL><INDENT>if doc.getchildren()[-<NUM_LIT:1>].tail is None:<EOL><INDENT>doc.getchildren()[-<NUM_LIT:1>].tail = chunk.word<EOL><DEDENT>else:<EOL><INDENT>doc.getchildren()[-<NUM_LIT:1>].tail += chunk.word<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if doc.text is None:<EOL><INDENT>doc.text = chunk.word<EOL><DEDENT>else:<EOL><INDENT>doc.text += chunk.word<EOL><DEDENT><DEDENT><DEDENT><DEDENT>result = ET.tostring(doc, encoding='<STR_LIT:utf-8>').decode('<STR_LIT:utf-8>')<EOL>result = html5lib.serialize(<EOL>html5lib.parseFragment(result), sanitize=True,<EOL>quote_attr_values='<STR_LIT>')<EOL>return result<EOL>
Returns concatenated HTML code with SPAN tag.

        Args:
          attributes (dict): A map of name-value pairs for attributes of output
              SPAN tags.
          max_length (:obj:`int`, optional): Maximum length of span enclosed chunk.

        Returns:
          The organized HTML code. (str)