import io


def mpl_svg(fig) -> str:
    """Return the SVG string of a matplotlib figure.

    Parameters
    ----------
    fig : Figure
        Matplotlib figure

    Returns
    -------
    str
        Figure SVG
    """
    f = io.BytesIO()
    fig.savefig(f, format="svg", bbox_inches="tight")
    svg = str(f.getvalue().decode("utf-8"))
    svg = "\n".join(svg.split("\n")[3:])
    return svg