code: def isnamedtuple(obj):
      
      return isinstance(obj, tuple) \
             and hasattr(obj, "_fields") \
             and hasattr(obj, "_asdict") \
             and callable(obj._asdict)
docs: Heuristic check if an object is a namedtuple.