def _is_namedtuple_like(x):
  """Helper which returns `True` if input is `collections.namedtuple`-like."""
  try:
    for fn in getattr(x, '_fields'):
      _ = getattr(x, fn)
    return True
  except AttributeError:
    return False