def ham_dist(bv1, bv2):
    """
    returns the hamming distance between two bit vectors
    represented as lists
    """
    if len(bv1) != len(bv2):
        raise Exception("fail: bitvectors of different length "+\
                        str(len(bv1))+", "+str(len(bv2)))
    total = 0
    for i, bit in enumerate(bv1):
        if bit != bv2[i]:
            total += 1
    return total