Convert d.keys to list in order to be compatible with py3k.