Cleaned Partitioner & PythonPartitioner source by taking out non-related logic to Utils

1. Replaced implicit implementation of mod(x, m) (modulo operation) in default partitioner with call to freshly defined mod(x, m) if Partitioner.scala
2. Replaced asInstanceOf/isInstanceOf with pattern matching; added a call to mod(x, m) again, thus, removed duplicated code chunks.

P.S. I also tried to replace unnecessary if-else checks with pattern-matching. Is that appropriate?

P.P.S. I messed with commits a little, so it would be better to view changed files straight.