<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Export
Save Images
  we can choose the format of the saving image in R.
pdf
png
svg
Save Images
We can choose the format of the saving image in Python. To execute this examples, first, we have to import sample data.
Write an image of the specified type to the specified file, at the specified scaling factor.
Note
Step1:  Save image as png
Step2:  Save image as svg
Step3:  Save image as pdf
<ASSISTANT_TASK:>
Python Code:
# import data from url
from py2cytoscape.data.cyrest_client import CyRestClient
# Create REST client for Cytoscape
cy = CyRestClient()
# Reset current session for fresh start
cy.session.delete()
# Load a sample network
network = cy.network.create_from('http://chianti.ucsd.edu/~kono/data/galFiltered.sif')
# Apply layout to the cytoscape network object
cy.layout.apply(network = network)
Explanation: Export
Save Images
  we can choose the format of the saving image in R.
pdf
png
svg
Save Images
We can choose the format of the saving image in Python. To execute this examples, first, we have to import sample data.
Write an image of the specified type to the specified file, at the specified scaling factor.
Note: the file is written to the file system of the computer upon which R is running, not Cytoscape – in those cases where they are different. It is saved to the working directory.
End of explanation
# png
from IPython.display import Image
network_png = network.get_png()
Image(network_png)
Explanation: Save image as png
End of explanation
# svg
from IPython.display import SVG
network_svg = network.get_svg()
SVG(network_svg)
Explanation: Save image as svg
End of explanation
# pdf
network_pdf = network.get_pdf()
# save the file
f = open('resultImage/scale_free_500.pdf', 'wb')
f.write(network_pdf)
f.close()
Explanation: Save image as pdf
End of explanation
<END_TASK>