code: def _normalize_bbox(self, bbox, size):
          
  
          bbox_ratio = float(bbox.width) / float(bbox.height)
          size_ratio = float(size[0]) / float(size[1])
  
          if round(size_ratio, 4) == round(bbox_ratio, 4):
              return bbox
          else:
              if bbox.height * size_ratio >= bbox.width:
                  diff = bbox.height*size_ratio - bbox.width
                  return BBox((bbox.xmin - diff/2, bbox.ymin, bbox.xmax + diff/2, bbox.ymax), bbox.projection)
              else:
                  diff = abs(bbox.width/size_ratio - bbox.height)
                  return BBox((bbox.xmin, bbox.ymin - diff/2, bbox.xmax, bbox.ymax + diff/2), bbox.projection)
docs: Returns this bbox normalized to match the ratio of the given size.