code: def is_iterator(obj):
      """
      Check if the object is an iterator.
  
      For example, lists are considered iterators
      but not strings or datetime objects.
  
      Parameters
      ----------
      obj : The object to check
  
      Returns
      -------
      is_iter : bool
          Whether `obj` is an iterator.
  
      Examples
      --------
      >>> is_iterator([1, 2, 3])
      True
      >>> is_iterator(datetime(2017, 1, 1))
      False
      >>> is_iterator("foo")
      False
      >>> is_iterator(1)
      False
      """
  
      if not hasattr(obj, "__iter__"):
          return False
  
      if PY2:
          return hasattr(obj, "next")
      else:
          # Python 3 generators have
          # __next__ instead of next
          return hasattr(obj, "__next__")
  
file_path: catboost/contrib/python/pandas/py2/pandas/core/dtypes/inference.py
imports: from numbers import Number
  import re
  import numpy
  from pandas._libs import lib
  from pandas.compat import PY2, Set, re_type, string_and_binary_types, string_types, text_type
  from pandas import compat
label_desc: Use image node_id 4 for calling a global function with example usage: is_iterator(obj) and returns: False, hasattr, hasattr