from functools import reduce


def _bit_list_to_bytes(bits):
    """Convert a sequence of truthy values into a byte string, MSB first."""
    return bytes(
        reduce(lambda a, b: (a << 1) | b, (int(bool(x)) for x in byte_bits))
        for byte_bits
        in zip(*[iter(bits)]*8)
    )