<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Exporting Images
<i class="fa fa-2x fa-paper-plane text-info fa-fw"> </i> Simple example
<i class="fa fa-2x fa-space-shuttle text-info fa-fw"> </i> Advanced examples
<i class="fa fa-2x fa-link text-info fa-fw"> </i> Linking and Layout
<i class="fa fa-2x fa-image text-info fa-fw"> </i> Exporting Images
Any SankeyWidget can be exported as either an raster (PNG) or vector (SVG) image.
Step1:  You can use IPython.display classes to ensure embedded versions of your diagram will persist in your notebook, even without JavaScript!
Step2:  Saving images to files
One way of saving images of the diagrams is to display them as above, then right-click and download.
You can also save the image data to disk using save_png and save_svg
Step3:  Because the diagram is actually drawn in the browser, it is not immediately available to save to disk. It can be convenient to display the diagram in the notebook and simultaneously save it, so auto_save_png and auto_save_svg methods are available which save the images as soon as they are available
<ASSISTANT_TASK:>
Python Code:
from ipysankeywidget import SankeyWidget
from ipywidgets import Layout
links = [
    {'source': 'start', 'target': 'A', 'value': 2},
    {'source': 'A', 'target': 'B', 'value': 2},
    {'source': 'C', 'target': 'A', 'value': 2},
    {'source': 'A', 'target': 'C', 'value': 2},
]
layout = Layout(width="500", height="200")
sankey = SankeyWidget(links=links, layout=layout)
sankey
Explanation: Exporting Images
<i class="fa fa-2x fa-paper-plane text-info fa-fw"> </i> Simple example
<i class="fa fa-2x fa-space-shuttle text-info fa-fw"> </i> Advanced examples
<i class="fa fa-2x fa-link text-info fa-fw"> </i> Linking and Layout
<i class="fa fa-2x fa-image text-info fa-fw"> </i> Exporting Images
Any SankeyWidget can be exported as either an raster (PNG) or vector (SVG) image.
End of explanation
from IPython.display import (
    Image,
    SVG
)
import base64
data = base64.decodebytes(bytes(sankey.png, 'ascii'))
Image(data)
SVG(sankey.svg)
Explanation: You can use IPython.display classes to ensure embedded versions of your diagram will persist in your notebook, even without JavaScript!
End of explanation
!rm test.svg test.png
sankey.save_svg('test.svg')
%%html
<img src="test.svg" />
Explanation: Saving images to files
One way of saving images of the diagrams is to display them as above, then right-click and download.
You can also save the image data to disk using save_png and save_svg:
End of explanation
# This won't work
s = SankeyWidget(links=links, layout=layout)
s.save_png('test.png')
s
%%html
<img src="test.png" />
# This does work
SankeyWidget(links=links, layout=layout).auto_save_png('test.png')
%%html
<img src="test.png" />
Explanation: Because the diagram is actually drawn in the browser, it is not immediately available to save to disk. It can be convenient to display the diagram in the notebook and simultaneously save it, so auto_save_png and auto_save_svg methods are available which save the images as soon as they are available:
End of explanation
<END_TASK>