code: def _trim_css_to_bounds(css, image_shape):
      """
      Make sure a tuple in (top, right, bottom, left) order is within the bounds of the image.
  
      :param css:  plain tuple representation of the rect in (top, right, bottom, left) order
      :param image_shape: numpy shape of the image array
      :return: a trimmed plain tuple representation of the rect in (top, right, bottom, left) order
      """
      return (
          max(css[0], 0),
          min(css[1], image_shape[1]),
          min(css[2], image_shape[0]),
          max(css[3], 0),
      )
  
file_path: face_recognition/face_recognition/api.py
imports: import PIL.Image
  import dlib
  import numpy
  from PIL import ImageFile
label_desc: Use image node_id 3 for calling a global function with example usage: _trim_css_to_bounds(css, image_shape) and returns: max,  min,  min,  max