not sure, but you may want to look up items() and iteritems()