code: def scipy_logprob(obs, p):
      if p.ndim > 1:
          if p.ndim > obs.ndim:
              obs = obs[((None,) * (p.ndim - obs.ndim) + (Ellipsis,))]
          elif p.ndim < obs.ndim:
              p = p[((None,) * (obs.ndim - p.ndim) + (Ellipsis,))]
  
          pattern = (p.ndim - 1,) + tuple(range(p.ndim - 1))
          return np.log(
              np.take_along_axis(p.transpose(pattern), obs, 0)
          )
      else:
          return np.log(p[obs])
  
imports: import numpy
  from pytensor import tensor
  from scipy import stats
  from pymc.logprob import icdf, logcdf, logp
label_desc: Use image node_id 1 for calling a global function with example usage: scipy_logprob(obs, p) and returns: np, np