def get_models_weight(models_info):
    """Parses the information about model ids and weights in the `models`
    key of the fusion dictionary. The contents of this key can be either
    list of the model IDs or a list of dictionaries with one entry per
    model.

    """
    model_ids = []
    weights = []
    try:
        model_info = models_info[0]
        if isinstance(model_info, dict):
            try:
                model_ids = [model["id"] for model in models_info]
            except KeyError:
                raise ValueError("The fusion information does not contain the"
                                 " model ids.")
            try:
                weights = [model["weight"] for model in models_info]
            except KeyError:
                weights = None
        else:
            model_ids = models_info
            weights = None
        return model_ids, weights
    except KeyError:
        raise ValueError("Failed to find the models in the fusion info.")