import glob


def find_files(model, ensemble, var_id):
    """
    Finds files that correspond to the given arguments.

    :param model: (string) Model chosen as argument at command line.
    :param ensemble: (string) Ensemble chosen as argument at command line.
    :param var_id: (string) Variable chosen as argument at command line.
    :return: The netCDF files that correspond to the arguments.
    """

    pattern = '/badc/cmip5/data/cmip5/output1/{model}/historical/mon/land' \
              '/Lmon/{ensemble}/latest/{var_id}/*.nc'
    glob_pattern = pattern.format(model=model,
                                  ensemble=ensemble, var_id=var_id)
    nc_files = glob.glob(glob_pattern)
    print(f'[INFO] found files: {nc_files}')

    return nc_files