code: def compute_num_instances(X, w, feature_names, condition=None):
      """Compute the number of instances, :math:`n`, conditioned on the protected
      attribute(s).
  
      Args:
          X (numpy.ndarray): Dataset features.
          w (numpy.ndarray): Instance weight vector.
          feature_names (list): Names of the features.
          condition (list(dict)): Same format as
              :func:`compute_boolean_conditioning_vector`.
  
      Returns:
          int: Number of instances (optionally conditioned).
      """
  
      # condition if necessary
      cond_vec = compute_boolean_conditioning_vector(
          X, feature_names, condition
      )
  
      return np.sum(w[cond_vec], dtype=np.float64)
  
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: compute_num_instances(X, w, feature_names, condition) and returns: np