def barriers_for_book(book, barrier_classes, fail_fast=False):
    """Return ReleaseBarrier instances for a book.

    Args:
        book: Row instance representing a book.
        barrier_classes: list of BaseReleaseBarrier subclasses
        fail_fast: If True, return the first barrier that applies.
            This can be used to test if a book has any barriers.

    Returns:
        list of BaseReleaseBarrier sub class instances representing
            all barriers that prevent the complete of the book.
    """
    barriers = []

    for barrier_class in barrier_classes:
        barrier = barrier_class(book)
        if barrier.applies():
            barriers.append(barrier)
        if fail_fast and barriers:
            break
    return barriers