code: def get_filepaths(
      root_path,
      ext=".mp4",
      replace_path=None,
      filter_fn=default_filepath_filter,
      glob_exp=None,
      parents_only=False,
  ):
      if replace_path is None:
          replace_path = root_path
      if glob_exp is None:
          glob_exp = "*{}".format(ext)
      paths = glob.glob(
          str(Path(root_path) / "**" / glob_exp), recursive=True
      )
      paths = [Path(p) for p in paths]
      if replace_path:
          rel_paths = [p.relative_to(replace_path) for p in paths]
      else:
          rel_paths = paths
      if filter_fn:
          rel_paths = [p for p in rel_paths if filter_fn(p)]
      if parents_only:
          parents = {rel_path.parent for rel_path in rel_paths}
          rel_paths = list(parents)
      return rel_paths
  
imports: import glob
  import numpy
  import os
  import re
  import tempfile
  from addict import Dict
  from collections import defaultdict
  from pathlib import Path
  from subprocess import call
  import cv2
  from ..dataset import GluonCVMotionDataset, DataSample, FieldNames, get_resized_video_location
  from ..io.video_io import VideoFrameReader, VideoSortedFolderReader, cmd_with_addn_args, FFMPEG_FOURCC
label_desc: Use image node_id 2 for calling a global function with example usage: get_filepaths(root_path, ext, replace_path, filter_fn, glob_exp, parents_only) and returns: rel_paths