'How to use rrdtool to read a rrd file in python

I need to read an rrd file using python. Can some one show me how should I use it? I am completely new to this and I could find some usefull thread How to read RRD file to get usage data? which gives an answer for my question. But i am not getting how to use it.

I have already installed rrdtool and hope I need only them to do this task.

Can someone give me a guide?

Here is my try

rrdtool fetch 'user_390.rrd' AVERAGE -r 300 -s 1496757600 -e 1496758800

Result

  File "<ipython-input-24-bacee8acaf1b>", line 1
    rrdtool fetch 'user_390.rrd' AVERAGE -r 300 -s 1496757600 -e 1496758800
                ^
SyntaxError: invalid syntax


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source