code: def clip_by_rect(geom, xmin, ymin, xmax, ymax):
      """Returns the portion of a geometry within a rectangle
  
      The geometry is clipped in a fast but possibly dirty way. The output is
      not guaranteed to be valid. No exceptions will be raised for topological
      errors.
  
      Parameters
      ----------
      geom : geometry
          The geometry to be clipped
      xmin : float
          Minimum x value of the rectangle
      ymin : float
          Minimum y value of the rectangle
      xmax : float
          Maximum x value of the rectangle
      ymax : float
          Maximum y value of the rectangle
  
      Notes
      -----
      New in 1.7.
      """
      if geom.is_empty:
          return geom
      return shapely.clip_by_rect(geom, xmin, ymin, xmax, ymax)
  
imports: from warnings import warn
  import shapely
  from shapely.algorithms.polylabel import polylabel
  from shapely.errors import GeometryTypeError, ShapelyDeprecationWarning
  from shapely.geometry import GeometryCollection, LineString, MultiLineString, MultiPoint, Point, Polygon, shape
  from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry
  from shapely.geometry.polygon import orient
  from shapely.prepared import prep
label_desc: Use image node_id 9 for calling a global function with example usage: clip_by_rect(geom, xmin, ymin, xmax, ymax) and returns: shapely, geom