hmm, I putting this in https://github.com/dimagi/core-hq/blob/master/corehq/apps/reports/generic.py#L264 might be a better place for this to live