def pd_get_cols_subset_by_template(df, template, rng):
    """
    Select certain columns from the supplied dataframe
    corresponding to a template like "X_{}"
    and a range values (e.g. ingegers like range(1, 4)) 
    inserted into the template. 
    """

    colnames = [template.format(el) for el in rng]
    return df[colnames]