python: Get result of redirected command