def get_new_carry_bits(res, carry, MASK=0xFFFFFFFF):
    """Get carry bits that would be produced by an add operation at each position
    01 + 01 = 10 <=> carry = 10 <=> carry 01 to next position
    01 + 00 = 01 <=> carry = 00 <=> no carry
    Examples:
        >>> res, carry = int("0101", 2), int("0011", 2)
        >>> bin(get_new_carry_bits(res, carry))
        '0b10'
    """
    # if there were 1s at the same position in both operands,
    # carry that one over to the next position
    return ((res & carry) << 1) & MASK