refactor: introduce a helper
refactor: introduce a helper

which has a very narrow purpose, and can use 'defer' to release the
lock, which is nice.

weaveworks/weave,tomwilkie/weave,tomwilkie/weave,tomwilkie/weave,weaveworks/weave,tomwilkie/weave,n054/weave,dpw/weave,n054/weave,weaveworks/weave,paulbellamy/weave,dpw/weave,dpw/weave,weaveworks/weave,n054/weave,dpw/weave,paulbellamy/weave,paulbellamy/weave,n054/weave,rade/weave,rade/weave,rade/weave,n054/weave,rade/weave,dpw/weave,rade/weave,tomwilkie/weave,paulbellamy/weave