@classmethod
  def GetFilter(cls, filter_name):
    """Return an initialized filter. Only initialize filters once.

    Args:
      filter_name: The name of the filter, as a string.

    Returns:
      an initialized instance of the filter.

    Raises:
      DefinitionError if the type of filter has not been defined.
    """
    # Check if the filter is defined in the registry.
    try:
      filt_cls = cls.GetPlugin(filter_name)
    except __HOLE__:
      raise DefinitionError("Filter %s does not exist." % filter_name)
    # Return an initialized filter, after initializing it in cls.filters if it
    # doesn't exist.
    return cls.filters.setdefault(filter_name, filt_cls())
dataset/ETHPy150Open google/grr/grr/lib/checks/filters.py/Filter.GetFilter