code: def build_resolution_filter(value=None, method="larger", image_idx=0):
      """
      Filter image based on its resolution.
      value: filter threshold
      method: Either larger or smaller
      image_idx: idx of the image in the tuple input
      """
      assert method == "larger" or method == "smaller"
      if method == "larger":
          logging.info(
              f"Only Selecting images with resolution >= {value}"
          )
          return (
              lambda x: x[image_idx].size[0] >= value
              and x[image_idx].size[1] >= value
          )
  
      logging.info(f"Only Selecting images with resolution <= {value}")
      return (
          lambda x: x[image_idx].size[0] <= value
          and x[image_idx].size[1] <= value
      )
  
imports: from typing import List, Optional
  import torch
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: build_resolution_filter(value, method, image_idx) and returns: function, function