<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def visit_html(self, node):
 """ Generate html elements and schematic json """

        parentClsNode = node.parent.parent
        assert parentClsNode.attributes['objtype'] == 'class'
        assert parentClsNode.attributes['domain'] == 'py'
        sign = node.parent.parent.children[0]
        assert isinstance(sign, desc_signature)
        absolute_name = sign.attributes['ids'][0]
        _construct = node["constructor_fn "] 
        serialno = node["serialno"]

        try:
            if _construct is None:
                unitCls = generic_import(absolute_name)
                if not issubclass(unitCls, Unit):
                    raise AssertionError(
                        "Can not use hwt-schematic sphinx directive and create schematic"
                        " for %s because it is not subclass of %r" % (absolute_name, Unit))
                u = unitCls()
            else:
                assert len(_construct) > 0 and RE_IS_ID.match(_construct), _construct
                _absolute_name = []
                assert ".." not in absolute_name, absolute_name
                for n in  absolute_name.split(sep=".")[:-1]:
                    if n != "":
                        _absolute_name.append(n)
                _absolute_name.append(_construct)
                
                constructor_fn = generic_import(_absolute_name)
                u = constructor_fn()
                if not isinstance(u, Unit):
                    raise AssertionError(
                        "Can not use hwt-schematic sphinx directive and create schematic"
                        " for %s because function did not returned instance of %r, (%r)" % (
                            _absolute_name, Unit, u))

            schem_file = SchematicPaths.get_sch_file_name_absolute(
                self.document, absolute_name, serialno)
            makedirs(path.dirname(schem_file), exist_ok=True)

            with open(schem_file, "w") as f:
                synthesised(u, DEFAULT_PLATFORM)
                g = UnitToLNode(u, optimizations=DEFAULT_LAYOUT_OPTIMIZATIONS)
                idStore = ElkIdStore()
                data = g.toElkJson(idStore)
                json.dump(data, f)

            viewer = SchematicPaths.get_sch_viewer_link(self.document)
            sch_name = SchematicPaths.get_sch_file_name(
                self.document, absolute_name, serialno)
            ref = nodes.reference(text=_("schematic"),  # internal=False,
                                  refuri="%s?schematic=%s" % (
                                      viewer,
                                      path.join(SchematicPaths.SCHEMATIC_DIR_PREFIX,
                                                sch_name)))
            node += ref
        except Exception as e:
            logging.error(e, exc_info=True)
            raise Exception(
                "Error  occured while processing of %s" % absolute_name)