Refactor use_sudo bits into a helper.