Python MAVFtp implementation

Hi there. I’m on the way to realize my own project that needs to automatically (from my own python script) send and receive files to/from pixhawk runned by arducopter. There aren’t any methods for ftp requests in mavutil.py, but MAVProxy can do this. I’ve checked the code of MAVProxy and found that i can upload files by sending network id + component id + payload via the file_transfer_protocol_send() function called from the connection object (i just caught their while debugging mavproxy code), but i have no ideas howto receive response from flight controller. Where is the response stream and how i can receive it? May somebody give me an example?

Full MAVProxy code for MavFTP is here: https://github.com/ArduPilot/MAVProxy/blob/master/MAVProxy/modules/mavproxy_ftp.py

Specifically handling the reponses is here: https://github.com/ArduPilot/MAVProxy/blob/23ba2ea56d8e3dd6e46b99e0f0a83ab5d685c153/MAVProxy/modules/mavproxy_ftp.py#L714

Thanks, i’ve seen (and used) this, but i’m asking specially for the way to receive a response stream. In funcs like def handle_list_reply(self, op, m) there is an object such a op.payload, that contain response data. But i cannot understand how to take it myself in my script.

upd: point of my question is the way how to take a response bytes from the connection object (mav = mavutil.mavlink_connection(connection_string, baud=baud_rate)). I can use it for sending (mav.mav.file_transfer_protocol_send()), but actually have no ideas howto use it for receiving.