<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean_tempdir(context, scenario):
 """ Clean up temporary test dirs for passed tests. Leave failed test dirs for manual inspection. """

    tempdir = getattr(context, 'tempdir', None)
    if tempdir and scenario.status == 'passed':
        shutil.rmtree(tempdir)
        del(context.tempdir)