def set_context_vars_or_values(
    context_vars: Optional[ContextVarsOrValues] = None,
) -> Dict[contextvars.ContextVar, contextvars.Token]:
    """Get the tokens for the given context variables or values.

    Args:
        context_vars: The context variables or values to get tokens for.

    Returns:
        A dictionary of context variables to tokens.
    """

    if context_vars is None:
        return {}

    if isinstance(context_vars, (dict, contextvars.Context)):
        return {cv: cv.set(v) for cv, v in context_vars.items()}

    return {cv: cv.set(cv.get()) for cv in context_vars}
Get the tokens for the given context variables or values.

    Args:
        context_vars: The context variables or values to get tokens for.

    Returns:
        A dictionary of context variables to tokens.
    
src/core/trulens/core/utils/python.py