def METHOD_NAME(
    content: Union[OCRResult, str],
    prediction_type: PredictionType,
    product_id: Optional[ProductIdentifier] = None,
    source_image: Optional[str] = None,
) -> list[Prediction]:
    """Extract predictions from OCR using for provided prediction type.
    :param content: OCR output to extract predictions from.
    :param prediction_type: type of the prediction to extract.
    :param product_id: identifier of the product (barcode + server type) to
        add to each prediction, defaults to None.
    :param source_image: `source_image`to add to each prediction, defaults to
        None.
    :return: The generated predictions.
    """
    if prediction_type in PREDICTION_TYPE_TO_FUNC:
        predictions = PREDICTION_TYPE_TO_FUNC[prediction_type](content)
        for prediction in predictions:
            prediction.source_image = source_image
            if product_id is not None:
                prediction.barcode = product_id.barcode
                prediction.server_type = product_id.server_type
        return predictions
    else:
        raise ValueError(f"unknown prediction type: {prediction_type}")