}
    if isinstance(input, dict):
        # the input could be a dict[string, string], so we sanitize the values
        values = list()
        # get the values from the dict
        for key in input:
            values.append(input[key])
        # sanitize the values
        sanitize_values_response: op.SanitizeResponse = op.sanitize(values)
        # reconstruct the dict with the sanitized values
        sanitized_input_values = sanitize_values_response.sanitized_texts
        idx = 0
        sanitized_input = dict()
        for key in input:
            sanitized_input[key] = sanitized_input_values[idx]
            idx += 1
        return {
            "sanitized_input": sanitized_input,
            "secure_context": sanitize_values_response.secure_context,
        }
    raise ValueError(f"Unexpected input type {type(input)}")
[docs]def desanitize(sanitized_text: str, secure_context: bytes) -> str:
    """
    Restore the original sensitive data from the sanitized text.
    Args:
        sanitized_text: Sanitized text.
        secure_context: Secure context returned by the `sanitize` function.
    Returns:
        De-sanitized text.
    """
    try:
        import opaqueprompts as op
    except ImportError:
        raise ImportError(
            "Could not import the `opaqueprompts` Python package, "
            "please install it with `pip install opaqueprompts`."
        )
    desanitize_response: op.DesanitizeResponse = op.desanitize(
        sanitized_text, secure_context
    )
    return desanitize_response.desanitized_text