from pathlib import Path
import stat


def is_special_file(path: Path) -> bool:
    """Check to see if a special file.

    It checks if the file is a character special device, block special device,
    FIFO, or socket.

    """
    mode = path.stat().st_mode
    # Character special device.
    if stat.S_ISCHR(mode):
        return True
    # Block special device
    if stat.S_ISBLK(mode):
        return True
    # FIFO.
    if stat.S_ISFIFO(mode):
        return True
    # Socket.
    if stat.S_ISSOCK(mode):
        return True
    return False