Wrote this, then realized I didn't need it. But it still seems like it might be useful.