Sorry,I am not familiar to the python.
Here is a sample code about deploying a custom security extension to SQL Reporting Services 2017,you may take a reference.
and here is the article I take reference：
Hope this will help you.
If the answer is the right solution, please click "Accept Answer" and upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.