def _todict(self):
        d = {}
        d['_type'] = self.__class__.__name__
        for name in self.__slots__:
            val = getattr(self, name)
            if val is None:
                pass
            elif name.endswith('_node'):
                val = val._todict()
            elif name.endswith('_nodes'):
                val = [x._todict() for x in val]
            elif isinstance(self, Bytes) and isinstance(val, bytes):
                val = 'BYTES:' + encodebytes(val).decode('utf-8').rstrip()
            elif isinstance(self, Num) and isinstance(val, complex):
                val = 'COMPLEX:' + repr(val)
            d[name] = val
        return d
Arguments:
dataset/ETHPy150Open zoofIO/flexx/flexx/pyscript/commonast.py/Node._todict--crossover with--dataset/ETHPy150Open NeuralEnsemble/python-neo/neo/io/neuroscopeio.py/NeuroScopeIO.__init__