import collections


def _load_filter(filter_str):
    """Load plugin filter from environment string."""

    if not filter_str:
        return {}

    filt = collections.defaultdict(list)
    for entry in filter_str.split(':'):
        section, pattern = entry.split('=')
        filt[section].extend(pattern.split(','))

    return filt