def find_settings_file(name, filesystem): """ Returns the path to a data file named `filename`. This function first checks to see if the data file exists in the data directory. If so, it returns that. Then, this function checks to see if the data file exists in the local directory. If so, it returns that. If neither of those things are true then this function will return the path to a new file in the data directory. """ local_path = os.path.abspath(name) data_path = paths.data_file_path(name) if filesystem.is_file(data_path): return data_path elif filesystem.is_file(local_path): return local_path else: return data_path