code: def _filter_data_frame(df, data_col, filter_col, filter_str=None):
      
      if filter_str is not None:
          relevant_cols = data_col + [filter_col]
          df.dropna(inplace=True, subset=relevant_cols)
          row_filter = df[filter_col].str.contains(filter_str, case=False)
          data_list = df[row_filter][data_col].to_dict()
      else:
          data_list = df[data_col].to_dict()
      return data_list
docs: Return a filtered data frame as a dictionary.