def compile_function(name, code, globs):
 co = compile(code.rstrip(), '<string>', 'single')
 ns = {}
 eval(co, globs, ns)
 return ns[name]

def compile_function ( name , code , globs ) : co = compile ( code . rstrip ( ) , '<string>' , 'single' ) ns = { } eval ( co , globs , ns ) return ns [ name ]
given a *code* string .