Convert Powershell Script To Python