code: def get_crop_box(self):
          
  
          # check if the flexible height option is active and applies
          self.set_format()
  
  
          if self.fmt.nocrop:
              # cropping not allowed
              return
  
          if self.crop_box:
              # crop coordinates passed in explicitely
              return self.crop_box
  
          iw, ih = self.image.size
  
          if iw <= self.fw and ih <= self.fh:
              # image fits in the target format, no need to crop
              return
  
          if self.image_ratio < self.format_ratio:
              # image taller than format
              diff = ih - (iw * self.fh / self.fw)
              return (0, diff // 2 , iw, ih - diff // 2)
  
          elif self.image_ratio > self.format_ratio:
              # image wider than format
              diff = iw - (ih * self.fw / self.fh)
              return (diff // 2, 0, iw - diff // 2, ih)
  
          else:
              # same ratio as format
              return
docs: Get coordinates of the rectangle defining the new image boundaries. It
          takes into acount any specific wishes from the model (explicitely
          passed in crop_box), the desired format and it's options
          (flexible_height, nocrop) and mainly it's ratio. After dimensions of
          the format were specified (see set_format), crop the image to the same
          ratio.