def preimageColumnToNumber(preimcol):
    """
    The preimage of a colum is input as a list of pairs of numbers

        [[a,b],[b,c],[c,d],...,[y,z]]

    The numbers a,b,c,..., which are between 0 and 3, inclusive,
    represent a row of an nx2 preimage of a column.
    This computes two numbers which represent the two columns of 
    this preimage.
    """
    leftnumber = 0
    rightnumber = 0
    for elem in preimcol:
        leftnumber <<= 1
        rightnumber <<= 1
        leftnumber += (elem&2) >> 1
        rightnumber += elem&1
    return (leftnumber,rightnumber)