def implement_outfile_parser(args):
    """
    Implement -o and -O arguments added by generate_outfile_parser.

    Parameters
    ----------
    args : argparse args object
        Results of parse_args() when called on an Argument Parser object.

    Returns
    -------
    outfile : str, None
        None if neither args.oname nor args.o was set, do not output to file.

    Notes
    -----
    Use for docstring in methods that accept outfile as an argument:
    outfile : str, None
        Path to output text file. Disables writing to file if set to None.

    """
    outfile = None
    if args.oname is not None:
        outfile = args.oname.strip()
        if not outfile.endswith(".txt"):
            outfile += ".txt"
    elif args.o:
        outfile = "out.txt"
    return outfile