def quantify(iterable, pred=bool, _sum=sum, _imap=map):
    """Count how many times the predicate is true.

    >>> quantify([True, False, True, True, False])
    3
    >>> quantify(range(20))
    19
    >>> quantify(range(20), lambda x: x < 10)
    10
    """
    return _sum(_imap(pred, iterable))
