from pathlib import Path
import tempfile
import shutil
import six


def create_temp_dir_with_constant_name(name):
    # type: (six.text_type) -> Path
    """
    Create temporary directory but with constant name.
    :param name: tmp directory name.
    :return: path object to new tmp directory.
    """
    tmp_dir_path = Path(tempfile.gettempdir()) / name
    if tmp_dir_path.exists():
        shutil.rmtree(six.text_type(tmp_dir_path), ignore_errors=True)
    tmp_dir_path.mkdir(exist_ok=True)

    return tmp_dir_path