<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wr_py_nts(fout_py, nts, docstring=None, varname="nts"):
 """Save namedtuples into a Python module."""

    if nts:
        with open(fout_py, 'w') as prt:
            prt.write('"""{DOCSTRING}"""\n\n'.format(DOCSTRING=docstring))
            prt.write("# Created: {DATE}\n".format(DATE=str(datetime.date.today())))
            prt_nts(prt, nts, varname)
            sys.stdout.write(" {N:7,} items WROTE: {PY}\n".format(N=len(nts), PY=fout_py))