def nodes_for_signature(self, spec, para):
        tokens = []
        if isinstance(spec, sb.create_spec):
            para += nodes.Text(" <options> ")
        elif isinstance(spec, sb.optional_spec):
            colord = nodes.inline(classes=['blue-text'])
            emphasis = nodes.emphasis()
            emphasis += nodes.Text(" (optional) ")
            colord += emphasis
            para += colord
            self.nodes_for_signature(spec.spec, para)
        elif isinstance(spec, sb.defaulted):
            colord = nodes.inline(classes=['green-text'])
            emphasis = nodes.emphasis()
            dflt = spec.default(None)
            if isinstance(dflt, six.string_types):
                dflt = '"{0}"'.format(dflt)
            emphasis += nodes.Text(" (default={0}) ".format(dflt))
            colord += emphasis
            para += colord
            self.nodes_for_signature(spec.spec, para)
        elif isinstance(spec, sb.required):
            colord = nodes.inline(classes=['red-text'])
            strong = nodes.strong()
            strong += nodes.Text(" (required) ")
            colord += strong
            para += colord
            self.nodes_for_signature(spec.spec, para)
        elif isinstance(spec, sb.listof):
            para += nodes.Text(" [ ")
            self.nodes_for_signature(spec.spec, para)
            para += nodes.Text(", ... ] ")
        elif isinstance(spec, sb.dictof):
            para += nodes.Text(" { ")
            self.nodes_for_signature(spec.name_spec, para)
            para += nodes.Text(" : ")
            self.nodes_for_signature(spec.value_spec, para)
            para += nodes.Text(" } ")
        elif isinstance(spec, many_item_formatted_spec):
            para += nodes.Text(" [")
            for i, s in enumerate(spec.specs):
                self.nodes_for_signature(s, para)
                if i < len(spec.specs)-1 or spec.optional_specs:
                    para += nodes.Text(', ')
            if spec.optional_specs:
                para += nodes.Text(" (")
                for i, s in enumerate(spec.optional_specs):
                    self.nodes_for_signature(s, para)
                    if i < len(spec.specs)-1:
                        para += nodes.Text(', ')
                para += nodes.Text(" )")
            para += nodes.Text("] ")

        elif isinstance(spec, (sb.container_spec, sb.formatted)):
            self.nodes_for_signature(spec.spec, para)
        elif isinstance(spec, sb.overridden):
            para += nodes.Text('"{0}"'.format(spec.value))
        else:
            spec_name = spec.__class__.__name__
            if spec_name.endswith("_spec"):
                spec_name = spec_name[:-5]
            para += nodes.Text(spec_name)

        return tokens
dataset/ETHPy150Open realestate-com-au/harpoon/docs/sphinx/ext/show_specs.py/ShowSpecsDirective.nodes_for_signature/original