<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mapping_items(mapping, _iteritems=_compat.iteritems):
 """Return an iterator over the ``mapping`` items, sort if it's a plain dict. [('eggs', 2), ('ham', 1), ('spam', 0)] [(0, 'spam'), (1, 'ham'), (2, 'eggs')] """

    if type(mapping) is dict:
        return iter(sorted(_iteritems(mapping)))
    return _iteritems(mapping)