import json


def get_predictions(inference_output):
    """
     Load inference output as a python list
    """
    predictions = []
    for line in inference_output:
        data = json.loads(line)
        prediction = {}
        for key, value in data.items():
            if key != "SageMakerOutput":
                prediction[key] = value
            else:
                if not isinstance(value, dict):
                    print("Error: Expected dictionary inside SageMakerOutput.")
                prediction.update(value)
        predictions.append(prediction)
    return predictions