def average_model_predictions(images_to_predict, models, weights=[]):
    """ It averages predictions of all given models equally or taking weights
    """
    sum_predictions = 0
    sum_weights = 0
    
    if not weights:
        for model in models:   
            sum_predictions += model.predict(images_to_predict, verbose=1)           
        return sum_predictions / len(models)
    else:
        for index, model in enumerate(models):
            sum_predictions += weights[index]*model.predict(images_to_predict, verbose=1)
            sum_weights += weights[index]
        return sum_predictions / sum_weights