class_docstr: Filters out elements from the source datapipe according to input ``filter_fn`` (functional name: ``filter``).
  
  Args:
      datapipe: Iterable DataPipe being filtered
      filter_fn: Customized function mapping an element to a boolean.
      input_col: Index or indices of data which ``filter_fn`` is applied, such as:
  
          - ``None`` as default to apply ``filter_fn`` to the data directly.
          - Integer(s) is used for list/tuple.
          - Key(s) is used for dict.
  
  Example:
      >>> # xdoctest: +SKIP
      >>> from torchdata.datapipes.iter import IterableWrapper
      >>> def is_even(n):
      ...     return n % 2 == 0
      >>> dp = IterableWrapper(range(5))
      >>> filter_dp = dp.filter(filter_fn=is_even)
      >>> list(filter_dp)
      [0, 2, 4]
class_docstr_tok: ["Filters","out","elements","from","the","source","datapipe","according","to","input","``","filter_fn","``","(","functional","name",":","``","filter","``",")",".","Args",":","datapipe",":","Iterable","DataPipe","being","filtered","filter_fn",":","Customized","function","mapping","an","element","to","a","boolean",".","input_col",":","Index","or","indices","of","data","which","``","filter_fn","``","is","applied",",","such","as",":","-","``","None","``","as","default","to","apply","``","filter_fn","``","to","the","data","directly",".","-","Integer","(","s",")","is","used","for","list\/tuple",".","-","Key","(","s",")","is","used","for","dict",".","Example",":",">",">",">","#","xdoctest",":","+SKIP",">",">",">","from","torchdata.datapipes.iter","import","IterableWrapper",">",">",">","def","is_even","(","n",")",":","...","return","n","%","2","==","0",">",">",">","dp","=","IterableWrapper","(","range","(","5",")",")",">",">",">","filter_dp","=","dp.filter","(","filter_fn=is_even",")",">",">",">","list","(","filter_dp",")","[","0",",","2",",","4","]"]
code: def _returnIfTrue(self, data: T) -> Tuple[bool, T]:
      condition = self._apply_filter_fn(data)
  
      if df_wrapper.is_column(condition):
          # We are operating on DataFrames filter here
          result = []
          for idx, mask in enumerate(df_wrapper.iterate(condition)):
              if mask:
                  result.append(df_wrapper.get_item(data, idx))
          if len(result):
              return True, df_wrapper.concat(result)
          else:
              return False, None  # type: ignore[return-value]
  
      if not isinstance(condition, bool):
          raise ValueError(
              "Boolean output is required for `filter_fn` of FilterIterDataPipe, got",
              type(condition),
          )
  
      return condition, data
  
file_path: pytorch/torch/utils/data/datapipes/iter/selecting.py
imports: from typing import Callable, Iterator, Tuple, TypeVar
  from torch.utils.data.datapipes._decorator import functional_datapipe
  from torch.utils.data.datapipes.datapipe import IterDataPipe
  from torch.utils.data.datapipes.dataframe import dataframe_wrapper
  from torch.utils.data.datapipes.utils.common import _check_unpickable_fn, StreamWrapper, validate_input_col
label_desc: Use image node_id 4 for calling the FilterIterDataPipe obj's underlying member method code with example usage: obj._returnIfTrue(data) and returns: condition,  data, True,  df_wrapper, False,  None