def create_tmp_dir(function):

    @functools.wraps(function)
    def decorated_function(*args, **kwargs):
        # Create directory
        tmp_dir_path = tempfile.mkdtemp()
        kwargs['tmp_dir_path'] = tmp_dir_path

        try:
            return function(*args, **kwargs)
        finally:
            # Remove directory
            utils.execute('rm', '-rf', tmp_dir_path)

    return decorated_function
Creates temporary directory for rsync purposes.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/virt/libvirt/volume/remotefs.py/create_tmp_dir