code: def _compile_itemsort():
      '''return sort function of mappings'''
      def is_extra(key_):
          return key_ is Extra
      def is_remove(key_):
          return isinstance(key_, Remove)
      def is_marker(key_):
          return isinstance(key_, Marker)
      def is_type(key_):
          return inspect.isclass(key_)
      def is_callable(key_):
          return callable(key_)
      priority = [(1, is_remove),
                  (2, is_marker),
                  (4, is_type),
                  (3, is_callable),
                  (5, is_extra)]
      def item_priority(item_):
          key_ = item_[0]
          for i, check_ in priority:
              if check_(key_):
                  return i
          return 0
      return item_priority