def METHOD_NAME(storage, study_name):
    n_previous_trials = 0
    try:
        if storage:
            study_found = False
            summary = optuna.study.get_all_study_summaries(storage=storage)
            for existing_study in summary:
                if existing_study.study_name == study_name:
                    study_found = True
                    n_previous_trials = existing_study.n_trials
                    logging.info('found a study with name=%s and %s trials', storage, n_previous_trials)
                    if existing_study.best_trial:
                        log_best_trial(existing_study.best_trial)
                    else:
                        logging.info('no best trial so far')
        if not study_found:
            logging.info('there is no study with name=%s so far', storage)
    except:
        logging.info('exception - there is no study with name=%s so far', storage)
    return n_previous_trials