import base64


def embed_png2html(figdata_png):
    """
    Convert the data to base64 format before the PNG data can be embedded in HTML
    Parameters:
        plt_fig: matplotlib figure
    Return:
        figdata_png: base64 encoding images
    """
    figdata_png = base64.b64encode(figdata_png)
    figdata_png = figdata_png.decode('utf-8') # base64.b64encode return byte
    return figdata_png