sorted returns a list, hence your error when you try to iterate over it, but because you can't order a dict you will have to deal with a list.
I have no idea what the larger context of your code is, but you could try adding an iterator to the resulting list. like this maybe?:
return iter(sorted(dict.iteritems()))
of course you will be getting back tuples now because sorted turned your dict into a list of tuples
ex:
say your dict was:
{'a':1,'c':3,'b':2}
sorted turns it into a list:
[('a',1),('b',2),('c',3)]
so when you actually iterate over the list you get back (in this example) a tuple composed of a string and an integer, but at least you will be able to iterate over it.