Some ranking algorithms in Python