def index( items ):
  """Index of the first nonzero item.

  Args:
      items: Any iterable object

  Returns:
      The index of the first item for which bool(item) returns True.
  """

  for i, item in enumerate(items):
    if item:
      return i
  raise ValueError