import time
import tempfile
from pathlib import Path


def make_temp_dir(prefix: str, parent_dir: str = '') -> str:
    """Create a new temporary directory.

    Parameters
    ----------
    prefix : str
        the directory prefix.
    parent_dir : str
        the parent directory.

    Returns
    -------
    dir_name : str
        the temporary directory name.
    """
    prefix += time.strftime("_%Y%m%d_%H%M%S")
    parent_dir = parent_dir or tempfile.gettempdir()
    Path(parent_dir).mkdir(parents=True, exist_ok=True)
    return tempfile.mkdtemp(prefix=prefix, dir=parent_dir)