import math


def evaluate(expression: str):
    """
    Evaluate a math expression.

    Args:
        expression: string representing the math expression to be eval()
    Returns:
        result of the math expression from eval()
    Raises:
        NameError: If expression passed is not from math library
    Examples:
        >>> evaluate("5 + 2")
        7
        >>> evaluate("sqrt(9)")
        3.0
        >>> evaluate("hello - hello")
        Traceback (most recent call last):
        ...
        NameError: The use of 'hello' is not allowed
    """

    # Compile the expression
    code = compile(expression, "<string>", "eval")
    allowed_names = {k: v for k, v in math.__dict__.items() if not k.startswith("__")}

    # Validate allowed names
    for name in code.co_names:
        if name not in allowed_names:
            raise NameError(f"The use of '{name}' is not allowed")
    return eval(code, {"__builtins__": {}}, allowed_names)