def METHOD_NAME(
    self,
    data: Union[List[Dict[str, Any]], Dict[str, Any]],
    identity_data: Dict[str, Any] = None,
) -> Union[List[Dict[str, Any]], Dict[str, Any]]:
    """
    - data: A list or a dict
    - identity_data: A dict of cached identity data
    returns a filtered dict, list of dicts, or empty list
    """
    if not data:
        return []
    # find value to filter by
    filter_value = self.value
    if isinstance(self.value, IdentityParamRef):
        if identity_data is None or identity_data.get(self.value.identity) is None:
            logger.warning(
                "Could not retrieve identity reference '{}' due to missing identity data for the following post processing strategy: {}",
                self.value.identity,
                self.name,
            )
            return []
        filter_value = identity_data.get(self.value.identity)  # type: ignore
    try:
        if isinstance(data, list):
            return [
                item
                for item in data
                if self._matches(
                    self.exact,
                    self.case_sensitive,
                    filter_value,  # type: ignore
                    self._get_nested_values(item, self.field),
                )
            ]
        return (
            data
            if self._matches(
                self.exact,
                self.case_sensitive,
                filter_value,  # type: ignore
                self._get_nested_values(data, self.field),
            )
            else []
        )
    except KeyError:
        logger.warning(
            "{} could not be found on data for the following post processing strategy: {}",
            self.field,
            self.name,
        )
        return []