code: def filter_keypoints(
      keypoints: Sequence[Sequence],
      rows: int,
      cols: int,
      remove_invisible: bool,
  ) -> Sequence[Sequence]:
      if not remove_invisible:
          return keypoints
  
      resulting_keypoints = []
      for kp in keypoints:
          x, y = kp[:2]
          if x < 0 or x >= cols:
              continue
          if y < 0 or y >= rows:
              continue
          resulting_keypoints.append(kp)
      return resulting_keypoints
  
imports: from __future__ import division
  import math
  import typing
  import warnings
  from typing import Any, Dict, List, Optional, Sequence, Tuple
  from .utils import DataProcessor, Params
label_desc: Use image node_id 4 for calling a global function with example usage: filter_keypoints(keypoints, rows, cols, remove_invisible) and returns: resulting_keypoints, keypoints