<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cleanTempDirs(job):
 """Remove temporarly created directories."""

    if job is CWLJob and job._succeeded:  # Only CWLJobs have this attribute.
        for tempDir in job.openTempDirs:
            if os.path.exists(tempDir):
                shutil.rmtree(tempDir)
        job.openTempDirs = []