Pulling in https://github.com/mapproxy/mapproxy/commit/59452ef186a69d6184426ec625c4df3283c10fed
Couldn't get Git to cherry-pick properly.