from io import StringIO


def svg_from_canvas(canvas):
    """ Return a string containing the SVG representation of a FigureCanvasSvg.
    """
    string_io = StringIO()
    canvas.print_svg(string_io)
    return string_io.getvalue()