Handling permissions in python code

to be written