code: def compute_sensitive_data(
      df,
      mode: str = "redact",
      detect_infotypes: bool = True,
      columns: Optional[list] = None,
      score_threshold: float = _DEFAULT_SCORE_THRESHOLD,
      sample_size: Union[int, float] = _SAMPLE_SIZE,
      engine_backend=None,
  ):
      """Identifies, redacts, and encrypts PII data.
  
      Note: sensitive_data uses Microsoft's Presidio in the backend. Presidio can be help identify sensitive data.
      However, because Presidio uses trained ML models, there is no guarantee that Presidio will find all sensitive information.
  
      Args:
          df (DataFrame): The dataframe
          mode (str): {'redact', 'encrypt'}
              redact: Redact the sensitive data
              encrypt: Anonymize the sensitive data
          detect_infotypes (bool): If True, identifies infotypes for each column
          columns ([str]): Defaults to None
          score_threshold (float): Minimum confidence value for detected entities to be returned. Default is 0.2.
          sample_size (int): Number of sampled rows used for identifying column infotypes. Default is 100.
          engine_backend: The backend analyzer engine. Default is presidio_analyzer.
  
      Raises:
          ValueError: `sample_size` greater than data size.
  
      Returns:
          SensitiveDataWidget
      """
      import data_describe.privacy.detection as ddsensitive  # noqa: Lazy load
  
      if columns:
          df = df[columns]
  
      sensitivewidget = ddsensitive.SensitiveDataWidget()
  
      if detect_infotypes:
          if sample_size > len(df):
              raise ValueError(
                  f"sample_size must be less than {len(df)}"
              )
          infotypes = identify_infotypes(
              df, engine_backend, sample_size
          )
          sensitivewidget.infotypes = infotypes
  
      if mode == "redact":
          df = df.applymap(
              lambda x: redact_info(
                  str(x), engine_backend, score_threshold
              )
          )
          sensitivewidget.redact = df
  
      elif mode == "encrypt":
          df = df.applymap(
              lambda x: encrypt_text(
                  str(x), engine_backend, score_threshold
              )
          )
          sensitivewidget.encrypt = df
  
      return sensitivewidget
  
imports: import hashlib
  import logging
  from functools import reduce
  from typing import Optional, Union
  import warnings
  from data_describe.misc.logging import OutputLogger
  from data_describe.backends import _get_compute_backend
  from data_describe.compat import _is_dataframe, _compat, _requires
  from data_describe.config._config import get_option
  from data_describe._widget import BaseWidget
label_desc: Use image node_id 2 for calling a global function with example usage: compute_sensitive_data(df, mode, detect_infotypes, columns, score_threshold, sample_size, engine_backend) and returns: sensitivewidget