It's kind of an odd thing to define a function in the middle of a code flow that is being executed. It makes more sense from a readability standpoint to put this right at the beginning and even more sense to put anything else into a ```if __name__ == '__main__':``` block.