Consider following the approach in https://github.com/hapi-server/client-python/blob/master/hapiclient/autoplot/autoplot.py#L98