Rewrite this, fixing several bugs, making it more Pythonic and silencing pylint.
Rewrite this, fixing several bugs, making it more Pythonic and silencing pylint.

NeCTAR-RC/reporting-api,NeCTAR-RC/reporting-api,NCI-Cloud/reporting-api,NCI-Cloud/reporting-api