from typing import List
from typing import Dict


def count(items: List, key_from: str, increment_fun=(lambda x: 1)):
    """
    Aggregate objects from a list by the attribute `key_from`.
    By default each item increments the counter by 1.
    """
    counts: Dict[str, int] = {}
    for item in items:
        key = getattr(item, key_from)
        increment = increment_fun(item)
        counts[key] = counts.get(key, 0) + increment
    return counts