@environmentfilter
def do_first(environment, seq):
 try:
  return next(iter(seq))
 except StopIteration:
  return environment.undefined('No first item, sequence was empty.')

@ environmentfilter def do_first ( environment , seq ) : try : return next ( iter ( seq ) ) except StopIteration : return environment . undefined ( 'No first item, sequence was empty.' )
return the first item of a sequence .