Calculates the parity of an integer, returning 0 if there are an even number of set bits, and -1 if there are an odd number.

def parityOf(int_type):
    """
    Calculates the parity of an integer, returning 0 if there are an even number of set bits, and -1 if there are an odd number. 
    """
    parity = 0
    while (int_type):
        parity = ~parity
        int_type = int_type & (int_type - 1)
    return(parity)