<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dir(suffix='', prefix='tmp', dir=None, force=True):
 """Create a temporary directory. A contextmanager that creates and returns a temporary directory, cleaning it up on exit. The force option specifies whether or not the directory is removed recursively. If set to `False` (the default is `True`), only an empty temporary directory will be removed. This is helpful to create temporary directories for things like mountpoints; otherwise a failing unmount would result in all files on the mounted volume to be deleted. :param suffix: Passed on to :func:`tempfile.mkdtemp`. :param prefix: Passed on to :func:`tempfile.mkdtemp`. :param dir: Passed on to :func:`tempfile.mkdtemp`. :param force: If true, recursively removes directory, otherwise just removes if empty. If directory isn't empty and `force` is `False`, :class:`OSError` is raised. :return: Path to the newly created temporary directory. """

    name = tempfile.mkdtemp(suffix, prefix, dir)

    try:
        yield name
    finally:
        try:
            if force:
                shutil.rmtree(name)
            else:
                os.rmdir(name)
        except OSError as e:
            if e.errno != 2:  # not found
                raise