This code can now be simplified, as was done in https://github.com/brooklyncentral/brooklyn/pull/500