Nested cross-validation runs an inner cross-validation inside each training set of an outer one: the inner folds choose the hyperparameters, the configuration so chosen is refitted on the outer training set and scored on the outer test fold. The mean outer score assesses the whole procedure, selection included.
ml_validation.selection.