<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def outfile_maker(inname, outext='.out', outname='', outdir='', append_to_name=''):
 """Create a default name for an output file based on the inname name, unless a output name is specified. Args: inname: Path to input file outext: Optional specified extension for output file (with the "."). Default is ".out". outfile: Optional specified name of output file. outdir: Optional path to output directory. Returns: str: Path to final output destination. Examples: 'P00001.out' 'P00001.out' 'P00001_new.out' 'P00001.mao' 'P00001_new.mao' 'P00001_aligned.new' 'P00001_aligned.out' 'P00001_aligned_new.out' '/my/dir/P00001_aligned.out' '/test/other/dir/P00001_new.out' '/test/other/dir/P00001_aligned.out' '/my/dir/P00001_aligned.out' """


    # TODO: CHECK IF OUTNAME IS A VALID FILE NAME!
    orig_dir, orig_name, orig_ext = split_folder_and_path(inname)

    # If output filename not provided, default is to take name of inname
    if not outname:
        outname = orig_name

    # Create new path in the same directory of old path if a new one isn't specified
    if not outdir:
        outdir = orig_dir

    # Append additional stuff to the filename if specified
    if append_to_name:
        outname += append_to_name

    # Join the output filename and output extension
    final_outfile = op.join(outdir, '{}{}'.format(outname, outext))

    return final_outfile