creating this function is a good idea but you cannot use iteritems() in Python 3