<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def convert_filename(txtfilename, outdir='.'):
 """Convert a .TXT filename to a Therion .TH filename"""

    return os.path.join(outdir, os.path.basename(txtfilename)).rsplit('.', 1)[0] + '.th'