code: def _spline_to_path_list(spline, height, replace_with_prev=False):
      """Converts SplineSet to a list of tokenized commands in svg path."""
      path = []
      prev_xy = []
      for line in spline.splitlines():
          if not line:
              continue
          tokens = line.split(" ")
          cmd = tokens[-2]
          if cmd not in "cml":
              # COMMAND NOT RECOGNIZED.
              return []
              # assert cmd in 'cml', 'Command not recognized: {}'.format(cmd)
          args = tokens[:-2]
          args = [float(x) for x in args if x]
  
          if replace_with_prev and cmd in "c":
              args[:2] = prev_xy
          prev_xy = args[-2:]
  
          new_y_args = []
          for i, a in enumerate(args):
              if i % 2 == 1:
                  new_y_args.append((height - a))
              else:
                  new_y_args.append((a))
  
          path.append([cmd.upper()] + new_y_args)
      return path
  
imports: import io
  import numpy
  from PIL import Image
  from six.moves import zip_longest
  from skimage import draw
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling a global function with example usage: _spline_to_path_list(spline, height, replace_with_prev) and returns: path, list