code: def calculate_correlation(
      config: Settings, df: Sized, correlation_name: str, summary: dict
  ) -> Optional[Sized]:
      """Calculate the correlation coefficients between variables for the correlation types selected in the config
      (auto, pearson, spearman, kendall, phi_k, cramers).
  
      Args:
          config: report Settings object
          df: The DataFrame with variables.
          correlation_name:
          summary: summary dictionary
  
      Returns:
          The correlation matrices for the given correlation measures. Return None if correlation is empty.
      """
      correlation_measures = {
          "auto": Auto,
          "pearson": Pearson,
          "spearman": Spearman,
          "kendall": Kendall,
          "cramers": Cramers,
          "phi_k": PhiK,
      }
  
      correlation = None
      try:
          correlation = correlation_measures[correlation_name].compute(
              config, df, summary
          )
      except (
          ValueError,
          AssertionError,
          TypeError,
          DataError,
          IndexError,
      ) as e:
          warn_correlation(correlation_name, str(e))
  
      if correlation is not None and len(correlation) <= 0:
          correlation = None
  
      return correlation
  
imports: import warnings
  from typing import Dict, List, Optional, Sized
  import numpy
  import pandas
  from multimethod import multimethod
  from ydata_profiling.config import Settings
label_desc: Use image node_id 2 for calling a global function with example usage: calculate_correlation(config, df, correlation_name, summary) and returns: correlation