from typing import OrderedDict


def _filter_citations(citations, classes):
    """
    Filter a dict of citations to include only those matching the give class names.

    Parameters
    ----------
    citations : dict
        Dict of citations keyed by class.
    classes : list of str
        List of class names for classes to include in the displayed citations.

    Returns
    -------
    dict
        The filtered dict of citations.
    """
    if classes is None:
        return citations

    cits = OrderedDict()
    for klass, cit in citations.items():
        if klass.__name__ in classes or '.'.join((klass.__module__, klass.__name__)) in classes:
            cits[klass] = cit
    return cits