def iter_first(sequence):
 it = iter(sequence)
 try:
  return next(it)
 except StopIteration:
  raise ValueError()

def iter_first ( sequence ) : it = iter ( sequence ) try : return next ( it ) except StopIteration : raise ValueError ( )
get the first element from an iterable or raise a valueerror if the iterator generates no values .