here's an example of something doing this more safely https://github.com/dimagi/commcare-hq/blob/master/custom/bihar/reports/supervisor.py#L462