code: def html_serialize(self, attributes, max_length=None):
      
      doc = ET.Element('span')
      for chunk in self:
        if (chunk.has_cjk() and
            not (max_length and len(chunk.word) > max_length)):
          ele = ET.Element('span')
          ele.text = chunk.word
          for key, val in attributes.items():
            ele.attrib[key] = val
          doc.append(ele)
        else:
          # add word without span tag for non-CJK text (e.g. English)
          # by appending it after the last element
          if doc.getchildren():
            if doc.getchildren()[-1].tail is None:
              doc.getchildren()[-1].tail = chunk.word
            else:
              doc.getchildren()[-1].tail += chunk.word
          else:
            if doc.text is None:
              doc.text = chunk.word
            else:
              doc.text += chunk.word
      result = ET.tostring(doc, encoding='utf-8').decode('utf-8')
      result = html5lib.serialize(
          html5lib.parseFragment(result), sanitize=True,
          quote_attr_values='always')
      return result
docs: 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)