docs: def convert_svg(svgstr, size, filepath, target):
     "convert to PDF or PNG"
     
     # PREPARE CONVERSION PER TYPE
     if target == "PDF":
        img = cairo.PDFSurface(filepath, size, size)
     
     elif target == "PNG":
        img = cairo.ImageSurface(cairo.FORMAT_ARGB32, size, size)
    
     else:
        system.exit("unknown file type conversion")
  
     # PROCESS
     ctx = cairo.Context(img)
     handler= rsvg.Handle(None, svgstr)
     iw,ih, fw,fh =  handler.get_dimension_data()
     ctx.translate(0,0)
     ctx.scale(size/fw, size/fh) # assumes bigger source SVG template
     handler.render_cairo(ctx)
  
     # FINALIZE PER TYPE
     if target == "PNG":
        img.write_to_png(filepath)