Python Redirect Stdout To String