function_mapping = {'foo': 'FooFunction', 'bar': 'BarFunction', 'baz':
    'BazFunction'}
formula = '(({foo}() + {bar}()) - ({baz}()/2) )'.format(**function_mapping)
Convert custom formula to python function