def occurrences(coll, value=None, **options):
count = {}<EOL>for element in coll:<EOL><INDENT>count[element] = count.get(element, <NUM_LIT:0>) + <NUM_LIT:1><EOL><DEDENT>if options:<EOL><INDENT>count = _filter_occurrences(count, options)<EOL><DEDENT>if value:<EOL><INDENT>count = count.get(value, <NUM_LIT:0>)<EOL><DEDENT>return count<EOL>
Return the occurrences of the elements in the collection

    :param coll: a collection
    :param value: a value in the collection
    :param options: 
        an optional keyword used as a criterion to filter the
        values in the collection
    :returns: the frequency of the values in the collection as a dictionary

    >>> occurrences((1, 1, 2, 3))
    {1: 2, 2: 1, 3: 1}
    >>> occurrences((1, 1, 2, 3), 1)
    2

    Filter the values of the occurrences that are 
    <, <=, >, >=, == or != than a given number::

        >>> occurrences((1, 1, 2, 3), lt=3)
        {1: 2, 2: 1, 3: 1}
        >>> occurrences((1, 1, 2, 3), gt=1)
        {1: 2}
        >>> occurrences((1, 1, 2, 3), ne=1)
        {1: 2}