I am new in python and trying to write a code in it. I am trying to run a select query but i am not able to to render a data to csv file ?

this is the psql query : 

```
# \copy (
# SELECT
# sr.imei,
# sensors.label,sr.created_at,
# sr.received_at,
# sr.type_id,
# 

```

but How to write it in python to render it to csv file ?

thanking you,
Vikas