Rendering an SVG containing a zigzag stitch in Python

The following will render an SVG resembling a zig-zag sewing stitch, using python: import pysvg.structure import pysvg.builders import pysvg.text import math import numpy as np from IPython.core.display import SVG svg_document = pysvg.structure.Svg() shape_builder = pysvg.builders.ShapeBuilder() style = pysvg.builders.StyleBuilder() style.setStrokeWidth(2) style.setStroke(‘black’) def complete(doc, file): doc.save(file) def line(a, b): if (a == None): return if (b == …