This function (`test_function`) looks like a test.  It assigns values to a bunch of local variables that are never used.  Nothing calls it.  It should be removed or moved to a file in the `tests` directory.  But that doesn't have to happen in this PR, if you want to restrict the changes in this PR to the more obvious bits of code clean up.