def get_svg(self, filename=None, labels=True, with_ims=None, **kwargs):
        if labels:
            if hasattr(self, "labels"):
                self.labels.attrib['style'] = "display:inline;"
            else:
                self.setup_labels(**kwargs)
        else:
            if hasattr(self, "labels"):
                self.labels.attrib['style'] = "display:none;"
        
        outsvg = copy.deepcopy(self.svg)
        if with_ims is not None:
            if isinstance(with_ims, (list, tuple)):
                with_ims = zip(range(len(with_ims)), with_ims)

            datalayer = _make_layer(outsvg.getroot(), "data")
            for imnum,im in reversed(with_ims):
                imlayer = _make_layer(datalayer, "image_%d" % imnum)
                img = E.image(
                    {"{http://www.w3.org/1999/xlink}href":"data:image/png;base64,%s"%im},
                    id="image_%d"%imnum, x="0", y="0",
                    width=str(self.svgshape[0]),
                    height=str(self.svgshape[1]),
                    )
                imlayer.append(img)
                outsvg.getroot().insert(0, imlayer)
        
        if filename is None:
            return etree.tostring(outsvg)
        else:
            with open(filename, "w") as outfile:
                outfile.write(etree.tostring(outsvg))
Returns an SVG with the included images.
dataset/ETHPy150Open gallantlab/pycortex/cortex/svgroi.py/ROIpack.get_svg