import inspect


def _isnamedtuple(f):
  """Returns True if the argument is a namedtuple-like."""
  if tuple not in inspect.getmro(type(f)):
    return False
  if not hasattr(f, '_fields'):
    return False
  fields = getattr(f, '_fields')
  if not isinstance(fields, tuple):
    return False
  if not all(isinstance(f, str) for f in fields):
    return False
  return True