For python 3, keys() returns a view, so I think you'll need to wrap that in list().