code: def audit(df, configs, preprocessed=False):
      """
  
      :param df:
      :param configs:
      :param preprocessed:
      :return:
      """
      if not preprocessed:
          df, attr_cols_input = preprocess_input_df(df)
          if not configs.attr_cols:
              configs.attr_cols = attr_cols_input
      g = Group()
      print("Welcome to Aequitas-Audit")
      print(
          "Fairness measures requested:",
          ",".join(configs.fair_measures_requested),
      )
      groups_model, attr_cols = g.get_crosstabs(
          df,
          score_thresholds=configs.score_thresholds,
          attr_cols=configs.attr_cols,
      )
      print("audit: df shape from the crosstabs:", groups_model.shape)
      b = Bias()
  
      # todo move this to the new configs object / the attr_cols now are passed through the configs object...
      ref_groups_method = configs.ref_groups_method
      if ref_groups_method == "predefined" and configs.ref_groups:
          bias_df = b.get_disparity_predefined_groups(
              groups_model,
              df,
              configs.ref_groups,
              check_significance=configs.check_significance,
              alpha=configs.alpha,
              selected_significance=configs.selected_significance,
              mask_significance=configs.mask_significance,
          )
      elif ref_groups_method == "majority":
          bias_df = b.get_disparity_major_group(
              groups_model,
              df,
              check_significance=configs.check_significance,
              alpha=configs.alpha,
              selected_significance=configs.selected_significance,
              mask_significance=configs.mask_significance,
          )
      else:
          bias_df = b.get_disparity_min_metric(
              df=groups_model,
              original_df=df,
              check_significance=configs.check_significance,
              alpha=configs.alpha,
              label_score_ref="fpr",
              selected_significance=configs.selected_significance,
              mask_significance=configs.mask_significance,
          )
  
      print("Any NaN?: ", bias_df.isnull().values.any())
      print("bias_df shape:", bias_df.shape)
  
      aqp = Plot()
  
      if configs.plot_bias_metrics:
          if len(configs.plot_bias_metrics) == 1:
              fig1 = aqp.plot_group_metric(
                  bias_df, group_metric=configs.plot_bias_metrics[0]
              )
  
          elif len(configs.plot_bias_metrics) > 1:
              fig1 = aqp.plot_group_metric_all(
                  bias_df, metrics=configs.plot_disparity_attributes
              )
  
          if (len(configs.plot_bias_disparities) == 1) and (
              len(configs.plot_disparity_attributes) == 1
          ):
              fig2 = aqp.plot_disparity(
                  bias_df,
                  group_metric=configs.plot_bias_disparities[0],
                  attribute_name=configs.plot_disparity_attributes[0],
              )
  
          elif (len(configs.plot_bias_disparities) > 1) or (
              len(configs.plot_disparity_attributes) > 1
          ):
              fig2 = aqp.plot_disparity_all(
                  bias_df,
                  metrics=configs.plot_bias_disparities,
                  attributes=configs.plot_disparity_attributes,
              )
  
      f = Fairness(tau=configs.fairness_threshold)
      print("Fairness Threshold:", configs.fairness_threshold)
      print("Fairness Measures:", configs.fair_measures_requested)
      group_value_df = f.get_group_value_fairness(
          bias_df,
          fair_measures_requested=configs.fair_measures_requested,
      )
      group_attribute_df = f.get_group_attribute_fairness(
          group_value_df,
          fair_measures_requested=configs.fair_measures_requested,
      )
      fair_results = f.get_overall_fairness(group_attribute_df)
  
      if configs.plot_bias_metrics:
          if len(configs.plot_bias_metrics) == 1:
              fig3 = aqp.plot_fairness_group(
                  group_value_df,
                  group_metric=configs.plot_bias_metrics[0],
              )
          elif len(configs.plot_bias_metrics) > 1:
              fig3 = aqp.plot_fairness_group_all(
                  group_value_df, metrics=configs.plot_bias_metrics
              )
  
          if (len(configs.plot_bias_disparities) == 1) and (
              len(configs.plot_disparity_attributes) == 1
          ):
              fig4 = aqp.plot_fairness_disparity(
                  group_value_df,
                  group_metric=configs.plot_bias_disparities[0],
                  attribute_name=configs.plot_disparity_attributes[0],
              )
          elif (len(configs.plot_bias_disparities) > 1) or (
              len(configs.plot_disparity_attributes) > 1
          ):
              fig4 = aqp.plot_fairness_disparity_all(
                  group_value_df,
                  metrics=configs.plot_bias_disparities,
                  attributes=configs.plot_disparity_attributes,
              )
  
      print(fair_results)
      report = None
      if configs.report is True:
          report = audit_report_markdown(
              configs,
              group_value_df,
              f.fair_measures_depend,
              fair_results,
          )
      return group_value_df, report
  
imports: import argparse
  import logging
  from sys import exit
  import pandas
  from aequitas.bias import Bias
  from aequitas.fairness import Fairness
  from aequitas.group import Group
  from aequitas.plotting import Plot
  from aequitas.preprocessing import preprocess_input_df
  from .utils.configs_loader import Configs
  from .utils.io import get_csv_data
  from .utils.io import get_db_data
  from .utils.io import get_engine
  from .utils.io import push_tocsv
  from .utils.io import push_todb
  from .utils.io import push_topdf
  from .utils.report import audit_report_markdown
label_desc: Use image node_id 2 for calling a global function with example usage: audit(df, configs, preprocessed) and returns: group_value_df,  report