def globalize_indentation(src):
    lines = src.splitlines()
    indent = len(lines[0]) - len(lines[0].strip(' '))
    func_src = ''
    for ii, l in enumerate(src.splitlines()):
        line = l[indent:]
        func_src += line + '\n'
    return func_src
Strip the indentation level so the code runs in the global scope.
dataset/ETHPy150Open lobocv/pyperform/pyperform/tools.py/globalize_indentation