code: def _apply_config(
      description: BaseDescription, config: Settings
  ) -> BaseDescription:
      """Apply the configuration for visualilzation purposes.
  
      This handles the cases in which the report description
      was computed prior to comparison with a different config
  
      Args:
          description: report summary
          config: the settings object for the ProfileReport
  
      Returns:
          the updated description
      """
      description.missing = {
          k: v
          for k, v in description.missing.items()
          if config.missing_diagrams[k]
      }
  
      description.correlations = {
          k: v
          for k, v in description.correlations.items()
          if config.correlations.get(
              k, Correlation(calculate=False).calculate
          )
      }
  
      samples = [
          config.samples.head,
          config.samples.tail,
          config.samples.random,
      ]
      samples = [s > 0 for s in samples]
      description.sample = description.sample if any(samples) else []
      description.duplicates = (
          description.duplicates if config.duplicates.head > 0 else None
      )
      description.scatter = (
          description.scatter if config.interactions.continuous else {}
      )
  
      return description
  
imports: import json
  import warnings
  from dataclasses import asdict
  from typing import Any, List, Optional, Tuple, Union
  import pandas
  from dacite import from_dict
  from ydata_profiling.config import Correlation, Settings
  from ydata_profiling.model import BaseDescription
  from ydata_profiling.model.alerts import Alert
  from ydata_profiling.profile_report import ProfileReport
label_desc: Use image node_id 12 for calling a global function with example usage: _apply_config(description, config) and returns: description