Interpret python code within python program

Is there a library for interpreting python code within a python program?
sample usage might look like this..

code = """
def hello():
    return 'hello'

hello()
"""

output = Interpreter.interpret(code)
print(output)

which then outputs
hello