def first(pipe, items=1):
    ''' first is essentially the next() function except it's second argument
        determines how many of the first items you want. If items is more than
        1 the output is an islice of the generator. If items is 1, the first
        item is returned
    '''
    pipe = iter(pipe)
    return next(pipe) if items == 1 else islice(pipe, 0, items)