human
What is a good Python code to detect type of namedtuple.
assistant
Here is a Python code to detect type of namedtuple

import collections

def is_namedtuple(obj):
    """
    Detect if obj is a namedtuple.

    :param obj: The object to be tested.
    :return: True if obj is a namedtuple, False otherwise.
    """
    return isinstance(obj, tuple) and hasattr(obj, '_fields')

# Enter the object
obj = (1, 2, 3)

# Calling the function
print((is_namedtuple(obj)))

#Example Output
# False

#Remember to inspect code for bugs.