parser = argparse.ArgumentParser()
parser.add_argument('--output', type=argparse.FileType('w'), help=
    'write the output to FILE', metavar='FILE')
args = parser.parse_args()
filename = args.output.name
Is there a way to find out the name of the file stdout is redirected to in Python