def METHOD_NAME(
    directory: str, followlinks: bool = True, ignore_list: Optional[List[str]] = None, hash_generator: Any = None
) -> str:
    """
    Parameters
    ----------
    directory : dict
        A directory with an absolute path
    followlinks : bool
        Follow symbolic links through the given directory
    ignore_list : list(str)
        The list of file/directory names to ignore in checksum
    hash_generator : hashlib._Hash
        The hashing method (hashlib _Hash object) that generates checksum. Defaults to hashlib.md5.
    Returns
    -------
    checksum hash of the directory.
    """
    ignore_set = set(ignore_list or [])
    if not hash_generator:
        hash_generator = _get_md5()
    files = list()
    # Walk through given directory and find all directories and files.
    for dirpath, dirnames, filenames in os.walk(directory, followlinks=followlinks):
        # > When topdown is True, the caller can modify the dirnames list in-place
        # > (perhaps using del or slice assignment) and walk() will only recurse
        # > into the subdirectories whose names remain in dirnames
        # > https://docs.python.org/library/os.html#os.walk
        dirnames[:] = [dirname for dirname in dirnames if dirname not in ignore_set]
        # Go through every file in the directory and sub-directory.
        for filepath in [os.path.join(dirpath, filename) for filename in filenames if filename not in ignore_set]:
            # Look at filename and contents.
            # Encode file's checksum to be utf-8 and bytes.
            files.append(filepath)
    files.sort()
    for file in files:
        hash_generator.update(os.path.relpath(file, directory).encode("utf-8"))
        filepath_checksum = file_checksum(file)
        hash_generator.update(filepath_checksum.encode("utf-8"))
    return cast(str, hash_generator.hexdigest())