def compare(n, p1, p2):
    """Compares two bits in an integer.

    Takes integers n, p1, p2. If the bit of n at positions p1 and p2 are
    the same, true is returned to the caller. Otherwise returns false. Bit
    positions start at 1 and go from low order to high. For example:
        n = 5, p1 = 1, p2 = 2

        n = 0b101, n_p1 = 1, n_p2 = 0
        
        In this case, False is returned.
    """
    n_p1 = n >> (p1 - 1)
    n_p2 = n >> (p2 - 1)
    if (n_p1 & 0b1) == (n_p2 & 0b1):
        return True
    else: return False