code: def make_weighted_logp(dist: pm.Distribution):
      """Create a function to compute a weighted logp
  
      Parameters
      ----------
      dist : pm.Distribution
          The PyMC distribution for which we want to get the weighted logp.
  
      Returns
      -------
      A function that computes the weighted logp
      """
  
      def logp(value, *dist_params, weights):
          weights = pt.as_tensor_variable(weights)
          return weights * pm.logp(dist.dist(*dist_params), value)
  
      return logp
  
file_path: bambi/bambi/backend/utils.py
imports: import inspect
  from functools import partial
  import pytensor.tensor
  import pymc
label_desc: Use image node_id 9 for calling a global function with example usage: make_weighted_logp(dist) and returns: logp, unknown