code: def iterable(obj):
      
      if isinstance(obj, string_types):
          return False    # avoid iterating over characters of a string
      if hasattr(obj, 'next'):
          return True    # any iterator will do
      try:
          len(obj)       # anything else that might work
      except TypeError:
          return False
      return True
docs: Returns ``True`` if *obj* can be iterated over and is *not* a  string.