def scrub(svgfile):
    """Remove data layers from an svg object prior to rendering

    Returns etree-parsed svg object
    """
    svg = etree.parse(svgfile, parser=parser)
    try:
        rmnode = _find_layer(svg, "data")
        rmnode.getparent().remove(rmnode)
    except __HOLE__:
        pass
    svgtag = svg.getroot()
    svgtag.attrib['id'] = "svgroi"
    inkver = "{%s}version"%inkns
    if inkver in svgtag.attrib:
        del svgtag.attrib[inkver]
    try:
        for tagname in ["{%s}namedview"%sodins, "{%s}metadata"%svgns]:
            for tag in svg.findall(".//%s"%tagname):
                tag.getparent().remove(tag)
    except:
        import traceback
        traceback.print_exc()

    return svg
dataset/ETHPy150Open gallantlab/pycortex/cortex/svgroi.py/scrub