Usin argparse with stdin and stdout

From http://stackoverflow.com/questions/7862987/consistent-way-to-redirect-both-stdin-stdout-to-files-in-python-using-optparse