def _bit_list_to_byte_array(arr):
    """Converts a list of bits into a bytes object of the corresponding bytes

    Example:
        [0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1] -> b'123'

    Args:
        arr (ndarray): List of bits to convert to bytes

    Returns:
        bytes: the corresponding bytes
    """
    bitstring = ''.join(map(str, map(int, arr)))
    return int(bitstring, 2).to_bytes(len(bitstring) // 8, byteorder='big')