code: def get_rendition_fill_size(spec, input_w, input_h, output_scale):
          
  
          width = input_w
          height = input_h
  
          scale = spec.get('scale')
          if scale:
              width = width / scale
              height = height / scale
  
          if spec.get('scale_min_width'):
              width = max(width, spec['spec_min_width'])
  
          if spec.get('scale_min_height'):
              height = max(height, spec['scale_min_height'])
  
          if spec.get('width'):
              width = min(width, spec['width'])
          if spec.get('max_width'):
              width = min(width, spec['max_width'])
  
          if spec.get('height'):
              height = min(height, spec['height'])
          if spec.get('max_height'):
              height = min(height, spec['max_height'])
  
          width = width * output_scale
          height = height * output_scale
  
          # Never scale to larger than the base rendition (but keep the output
          # aspect)
          if width > input_w:
              height = height * input_w / width
              width = input_w
  
          if height > input_h:
              width = width * input_h / height
              height = input_h
  
          # Determine the box size
          box_w = min(input_w, round(width * input_h / height))
          box_h = min(input_h, round(height * input_w / width))
  
          # Box offset
          box_x = round((input_w - box_w) * spec.get('fill_crop_x', 0.5))
          box_y = round((input_h - box_h) * spec.get('fill_crop_y', 0.5))
  
          return (round(width), round(height)), (box_x, box_y, box_x + box_w, box_y + box_h)
docs: Determine the scale-crop size given the provided spec