from typing import Iterable
from typing import Hashable
from typing import Callable
from typing import Dict


def _count(
    values: Iterable[Hashable], filter_: Callable = lambda value: True
) -> Dict[Hashable, int]:
    """
    Returns dictionary where keys are unique `values` and values
    there are entry counters. Adding condition can be specified by
    `filter_` argument which `lambda value: True` by default.
    """
    counted = {}
    for value in values:
        if filter_(value):
            if value in counted:
                counted[value] += 1
            else:
                counted[value] = 1
    return counted