code: def coll_to_tuples(cls, coll):
          
          if isinstance(coll, basestring):
              raise exc.CollectionCoerceError(
                  passed=coll,
                  colltype=cls,
              )
          if isinstance(coll, collections.Mapping):
              i = 0
              for k in sorted(coll.keys()):
                  yield (i, coll[k])
          elif isinstance(coll, (collections.Sequence, types.GeneratorType)) or (
              hasattr(coll, "next") and callable(coll.next)
          ) or (
              hasattr(coll, "__iter__") and callable(coll.__iter__)
          ):
              i = 0
              for v in coll:
                  yield i, v
                  i += 1
          elif not coll:
              return
          else:
              raise exc.CollectionCoerceError(
                  passed=coll,
                  colltype=cls,
              )
docs: ``coll_to_tuples`` is capable of unpacking its own collection types
          (`list`), ``collections.Mapping`` objects, as well generators,
          sequences and iterators.  Returns ``(*int*, Value)``.  Does not coerce
          items.