Ask for a filename to open, and returned the opened file

def askopenfile(mode="r", **options):
    "Ask for a filename to open, and returned the opened file"

    filename = askopenfilename(**options)
    if filename:
        return open(filename, mode)
    return None