def from_bits(bits: list) -> bytes:
    """Convert bit list to bytes"""
    if not len(bits) % 8 == 0:
        print('Invalid bits length !')
        return b''
    _bytes = b''
    offset = 0
    for i in range(0,int(len(bits) / 8)):
        byte = int(''.join(map(lambda x: str(x), bits[offset:offset+8])), 2).to_bytes(1, byteorder='little')
        _bytes += byte
        offset += 8
    return _bytes