Read full playlist to write it to file

Hi Guys,

how can i read the full current playlist from player to save it to file in python (should be a backup which is later restored to play again).
I found some code snippets but seems really outdated.

Any help would be nice.