def arePermsEqualParity(perm0, perm1):
    """Check if 2 permutations are of equal parity.
    Assume that both permutation lists are of equal length
    and have the same elements. No need to check for these
    conditions.
    """
transCount = 0
for loc in range(len(perm0) - 1):
    if perm0[loc] != perm1[loc]:
        sloc = perm1.index(perm0[loc])
perm1[loc], perm1[sloc] = perm1[sloc], perm1[loc]
transCount += 1
if transCount % 2 == 0:
    return True
else:
    return False
How to check if permutations have equal parity?