def lookahead(n, iterable):
 for value in islice(copy.copy(iterable), n, None):
  return value
 raise IndexError(n)

def lookahead ( n , iterable ) : for value in islice ( copy . copy ( iterable ) , n , None ) : return value raise IndexError ( n )
lookahead -> object inspects the upcoming element at index n without advancing the iterator .