code: def test_conditional_demographic_disparity():
      prot_attr = pd.Series([0, 0, 1, 1, 2, 2, 2], name="sex")
      y = pd.Series([0, 1, 0, 1, 0, 1, 0], index=prot_attr)
      sample_weight = [1, 2, 3, 4, 3, 2, 1]
      cdd = conditional_demographic_disparity(
          y, sample_weight=sample_weight
      )
      assert cdd == (3 * (1 - 2) + 7 * (3 - 4) + 6 * (4 - 2)) / (8 * 16)
  
imports: from functools import partial
  import numpy
  import pandas
  import pytest
  from numpy.testing import assert_almost_equal
  from sklearn.linear_model import LogisticRegression
  from aif360.datasets import AdultDataset
  from aif360.sklearn.datasets import fetch_adult
  from aif360.metrics import ClassificationMetric
  from aif360.sklearn.metrics import consistency_score, specificity_score, selection_rate, base_rate, smoothed_base_rate, generalized_fpr, generalized_fnr, disparate_impact_ratio, statistical_parity_difference, equal_opportunity_difference, average_odds_difference, average_predictive_value_difference, average_odds_error, smoothed_edf, df_bias_amplification, generalized_entropy_error, between_group_generalized_entropy_error, class_imbalance, kl_divergence, conditional_demographic_disparity, intersection, one_vs_rest, make_scorer
label_desc: Use image node_id 21 for calling a global function with example usage: test_conditional_demographic_disparity() without return types