def return_heatmap_data(df, method, drop_criteria):
    """Create and return a dictionary of specified correlations between df columns.

    This function is called from the return_heatmap method.
    Pairwise correlations between columns are calculated.

    Args:
    method: string. Method to be used for calculating correlation between df columns
            ('pearson', 'spearman' or 'kendall').
    drop_criteria: string or list of columns in df to be used for determining data to drop.
                  'any_rows': drops any rows in the data containing NaNs
                  'any_cols': drops any columns in the data containing NaNs
                  list: list of columns to be used for subset of drop_na function
                  None: no rows or columns with NaNs are dropped from the data

    Returns:
    heatmap_data: dictionary.  A dictionary of data required for heatmap figure created
    and returned by the return_heatmap method.
    """
    heatmap_data = {}
    if drop_criteria == 'any_rows':
        corr_data = df.dropna(axis=0, how='any')
        heatmap_data['drop_count'] = df.shape[0] - corr_data.shape[0]
        heatmap_data['title_text'] = 'rows'
    elif drop_criteria == 'any_cols':
        corr_data = df.dropna(axis=1, how='any')
        heatmap_data['drop_count'] = df.shape[1] - corr_data.shape[1]
        heatmap_data['title_text'] = 'columns'
    elif type(drop_criteria) == list:
        try:
            corr_data = df.dropna(axis=0, subset=drop_criteria)
            heatmap_data['drop_count'] = df.shape[0] - corr_data.shape[0]
            heatmap_data['title_text'
                ] = f"rows (subsetted on {', '.join(drop_criteria)}) Null values"
        except KeyError:
            print(
                'Specified column does not exist in data.  No Null values were dropped.'
                )
            corr_data = df.copy()
            heatmap_data['drop_count'] = 0
            heatmap_data['title_text'] = 'rows or columns'
    else:
        if drop_criteria != None:
            print(
                'Incorrect drop criteria specified.  No Null values were dropped.'
                )
        corr_data = df.copy()
        heatmap_data['drop_count'] = 0
        heatmap_data['title_text'] = 'rows or columns'
    heatmap_data['corrs'] = corr_data.corr(method)
    return heatmap_data
