Pearson hashing in Python