This isn't something you need to fix now, but one pattern that a few of the other modules use is to create a dictionary that maps the dispatch to the function it needs to call. That way, you don't need so many elif statements.