def METHOD_NAME(self, dxo_collection: Union[List[DXO], Dict[str, DXO]], shareable, fl_ctx):
    if isinstance(dxo_collection, list):
        for i in range(len(dxo_collection)):
            v = dxo_collection[i]
            if not isinstance(v, DXO):
                continue
            if v.data_kind == DataKind.COLLECTION:
                self.METHOD_NAME(v.data, shareable, fl_ctx)
            elif not self.data_kinds or v.data_kind in self.data_kinds:
                dxo_collection[i] = self._apply_filter(v, shareable, fl_ctx)
    elif isinstance(dxo_collection, dict):
        for k, v in dxo_collection.items():
            assert isinstance(v, DXO)
            if v.data_kind == DataKind.COLLECTION:
                self.METHOD_NAME(v.data, shareable, fl_ctx)
            elif not self.data_kinds or v.data_kind in self.data_kinds:
                dxo_collection[k] = self._apply_filter(v, shareable, fl_ctx)
    else:
        raise ValueError(f"DXO COLLECTION must be a dict or list but got {type(dxo_collection)}")