def _parse_svg_pts(self, datastr):
        data = list(_tokenize_path(datastr))
        #data = data.replace(",", " ").split()
        if data.pop(0).lower() != "m":
            raise ValueError("Unknown path format")
        #offset = np.array([float(x) for x in data[1].split(',')])
        offset = np.array(map(float, [data.pop(0), data.pop(0)]))
        mode = "l"
        pts = [[offset[0], offset[1]]]
        
        def canfloat(n):
            try:
                float(n)
                return True
            except __HOLE__:
                return False

        lastlen = len(data)
        while len(data) > 0:
            #print mode, data
            if not canfloat(data[0]):
                mode = data.pop(0)
                continue
            if mode == "l":
                offset += list(map(float, [data.pop(0), data.pop(0)]))
            elif mode == "L":
                offset = np.array(list(map(float, [data.pop(0), data.pop(0)])))
            elif mode == "c":
                data = data[4:]
                offset += list(map(float, [data.pop(0), data.pop(0)]))
            elif mode == "C":
                data = data[4:]
                offset = np.array(list(map(float, [data.pop(0), data.pop(0)])))

            ## Check to see if nothing has happened, and, if so, fail
            if len(data) == lastlen:
                raise ValueError("Error parsing path.")
            else:
                lastlen = len(data)

            pts.append([offset[0],offset[1]])

        pts = np.array(pts)
        pts /= self.parent.svgshape
        pts[:,1] = 1-pts[:,1]
        return pts
dataset/ETHPy150Open gallantlab/pycortex/cortex/svgroi.py/ROI._parse_svg_pts