code: def load_parameters(
          distribution,
          method_name,
          parameters=None,
          cache=None,
          cache_key=lambda x:x,
  ):
      
      from .. import baseclass
      if cache is None:
          cache = {}
      if parameters is None:
          parameters = {}
      parameters_ = distribution.prm.copy()
      parameters_.update(**parameters)
      parameters = parameters_
  
      # self aware and should handle things itself:
      if contains_call_signature(getattr(distribution, method_name), "cache"):
          parameters["cache"] = cache
  
      # dumb distribution and just wants to evaluate:
      else:
          for key, value in parameters.items():
              if isinstance(value, baseclass.Dist):
                  value = cache_key(value)
                  if value in cache:
                      parameters[key] = cache[value]
                  else:
                      raise baseclass.StochasticallyDependentError(
                          "evaluating under-defined distribution {}.".format(distribution))
  
      return parameters
docs: Load parameter values by filling them in from cache.
  
      Args:
          distribution (Dist):
              The distribution to load parameters from.
          method_name (str):
              Name of the method for where the parameters should be used.
              Typically ``"_pdf"``, ``_cdf`` or the like.
          parameters (:py:data:typing.Any):
              Default parameters to use if there are no cache to retrieve. Use
              the distributions internal parameters, if not provided.
          cache (:py:data:typing.Any):
              A dictionary containing previous evaluations from the stack. If
              a parameters contains a distribution that contains in the cache, it
              will be replaced with the cache value. If omitted, a new one will
              be created.
          cache_key (:py:data:typing.Any)
              Redefine the keys of the cache to suite other purposes.
  
      Returns:
          Same as ``parameters``, if provided. The ``distribution`` parameter if
          not. In either case, parameters may be updated with cache values (if
          provided) or by ``cache`` if the call signature of ``method_name`` (on
          ``distribution``) contains an ``cache`` argument.