def num_batches(adhoc_modelname):
    """
    Helper function to best_accuracy_trainval_loss. Takes a model name of the
    form "modelnamebatch01234" and returns the number of batches used to train
    it, which in this example is 5 (since [0, 1, 2, 3, 4] has five elements).
    N.B. the number 10 counts 2 toward the number of batches. This is not a
    problem, since this function is only used to order lists in increasing
    order.
    """
    number_of_batches = len(adhoc_modelname[adhoc_modelname.rfind("h")+1:])
    return number_of_batches