def get_samples(marginal, samplers, parameter, n_samples, **kwargs):
    """Sample from a marginal distribution of a parameter.

    Parameters
    ----------
    marginal : int or tuple
      Specifies which marginal to sample from.
    samplers : dict
      A mapping from the marginals of the parameter to the corresponding sampler.
    parameter : str
      The name of the parameter in the inference model.
    n_samples : int
      The number of samples to produce.
    **kwargs
      Additional arguments passed for sampling.

    Returns
    -------
    samples : np.ndarray
      Samples from the specified marginal distribution.
    """
    return samplers[marginal].sample(n_samples, **kwargs).outputs[parameter][:, marginal]