Download logs using pymavlink

Hello everyone ,
I would like to know how to download a log saved on the sd card via the pymavlink library commands. I would need this to automate the process of dowloading from multiple drones.

I have already check the mavlink commands page and i found these commands :

LOG_REQUEST_LIST
LOG ENTRY
LOG REQUEST DATA
LOG DATA

From what I understand these commands are used to request the log list and then request the log data by specifying its id from the list. What is not clear to me is the procedure for downloading the log and having it saved on the computer with a .bin or .log extension as if it had been downloaded normally with Mission Planner or MavProxy.

Can anyone clarify this procedure for me?

Thanks

log download <log_number> <file_save_to_name>