def byte2bit(in_bytes):
    """
    Function for converting a byte stream into the corresponding bit stream.
    Original Author: Filippo Valmori
    """
    in_len = len(in_bytes)
    out_len = in_len << 3
    out_bits = [0] * out_len
    for j in range(out_len):
        byte_idx = j >> 3
        bit_idx = 7 - j % 8
        if (in_bytes[byte_idx] >> bit_idx) % 2:
            out_bits[j] = 1
    return out_bits
