We should add a note here to say this is not recommended - it's better to do it on the webserver (nginx/apache) rather than in the python.