`contents` may be None, so this can fail, can't it?