def count_iterator(it):
    """
	Count the length of an iterable. This consumes the iterator, if it doesn't
	have a len()
	"""
    try:
        return len(it)
    except TypeError:
        return sum(1 for _ in it)
