My goal is to generate functions dynamically and then save them in a file. For e.g, in my current attempt, On calling `create_file`

```
import io

def create_file():
    nested_func = make_nested_func()
    write_to_file([nested_func, a_root_func], '/tmp/code.py')

def a_root_func(x):
    pass

def make_nested_func():
    def a_nested_func(b, k):
        return b, k

    return a_nested_func

def write_to_file(code_list, path):
    import inspect
    code_str_list = [inspect.getsource(c) for c in code_list]
    with open(path, 'w') as ofh:
        for c in code_str_list:
            fh = io.StringIO(c)
            ofh.writelines(fh.readlines())
            ofh.write('\n')

create_file()

```

The output I want is('/tmp/code.py'):

```
def a_nested_func(b, k):
        return b, k

def a_root_func(x):
    pass

```

The output I get is('/tmp/code.py'):

```
    def a_nested_func(b, k):
        return b, k

def a_root_func(x):
    pass

```

`a_nested_func` is indented. How can I reduce the indentation? I can do `lstrip` etc. but I wonder if there is a better way.