def take(n, it, stop_short=False):
    """
	>>> list(take(3, iter([1,2,3,4,5])))
	[1, 2, 3]
	>>> list(take(0, iter([1,2,3,4,5])))
	[]
	>>> list(take(3, iter([1]), True))
	[1]
	"""
    results = []
    try:
        while n > 0:
            results.append(next(it))
            n -= 1
        return results
    except StopIteration:
        if stop_short:
            return results
        raise
