In Python 3, dict.keys doesn't return a list, but a set-like object that represents a view of the dictionary's keys and doesn't support indexing. Formula therefor didn't worked with Python 3.