This involves a number of changes. The biggest is the conversion of the "x in y.keys()" statements
to "x in y". For code which requires a list of keys, the function calls "list(y.keys())" or
preferably "sorted(y.keys())" are used throughout (sorted() ensures that the list will be of the
same order on all operating systems and Python implementations). A number of "x in list(y.keys())"
statements were simplified to "x in y", some list() calls changed to sorted(), and some unnecessary
list() calls were removed.