def _is_namedtuple_instance(x):
  """Checks if `x` is an instance of a `namedtuple` type."""
  if not isinstance(x, tuple):
    return False
  return hasattr(x, '_fields')
Checks if `x` is an instance of a `namedtuple` type.
trax/fastmath/numpy.py