def METHOD_NAME(activation: str, openai_gelu: bool = False, onnx_safe: bool = False) -> Callable:
    """ Converts an activation function represented as a string to a function.
    Args:
        activation (str): string representation of an activation function, typically gotten from the model config.
        openai_gelu (bool): whether to use the OpenAI GELU implementation. Used with HF compatibility.
        onnx_safe (bool): whether to use the ONNX-compatible implementation of GELU.
    Returns:
        Callable: the activation function.
    """
    supported_activations = [
        'gelu',
        'geglu',
        'reglu',
        'swiglu',
        'squared-relu',
        'fast-geglu',
        'fast-swiglu',
        'fast-reglu',
    ]
    if activation not in supported_activations:
        raise ValueError(f"Unsupported activation {activation}. Supported activations: {supported_activations} ")
    # Give openai_gelu precedence over other activations if set, for HF compatibility.
    # Normally this is off and shouldn't affect regular model training.
    if openai_gelu:
        activation_func = openai_gelu_func
    elif activation in ["gelu", "geglu", "fast-geglu"]:
        activation_func = F.gelu
    elif onnx_safe:
        activation_func = erf_gelu
    elif activation in ["reglu", "fast-reglu"]:
        activation_func = F.relu
    elif activation in ["swiglu", "fast-swiglu"]:
        # SiLU or sigmoid linear unit is the same as swish with beta = 1 (which is what https://arxiv.org/pdf/2002.05202.pdf uses.)
        activation_func = F.silu
    elif activation == 'squared-relu':
        activation_func = squared_relu
    return activation_func