def METHOD_NAME(fifo_path, data):
    """Writes the data to the FIFO or raises `FIFOError`"""
    assert isinstance(data, bytes)
    # This will raise if the FIFO doesn't exist or there is no reader
    try:
        fifo = os.open(fifo_path, os.O_WRONLY | os.O_NONBLOCK)
    except OSError:
        try:
            os.unlink(fifo_path)
        except OSError:
            pass
        raise
    else:
        try:
            os.close(fifo)
        except OSError:
            pass
    try:
        signal.signal(signal.SIGALRM, _sigalrm_timeout)
        signal.alarm(FIFO_TIMEOUT)
        with open(fifo_path, "wb") as f:
            signal.signal(signal.SIGALRM, signal.SIG_IGN)
            f.write(data)
    except (OSError, TimeoutError):
        # Unable to write to the fifo. Removing it.
        try:
            os.unlink(fifo_path)
        except OSError:
            pass
        raise FIFOError(f"Couldn't write to fifo {fifo_path!r}")