<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setdirs(outfiles):
 """Create the directories if need be"""

    for k in outfiles:
        fname=outfiles[k]
        dname= os.path.dirname(fname)
        if not os.path.isdir(dname):
            os.mkdir(dname)