I do not think that it has much to do with Python, it is rather a design decision.
Only for these lines I will not create a separate module; however, if you use it 2 to 3 times, I would not copy the code. If you later want to change something, you need only one change that supports functionality.
Also, the methods seem very versatile, so you can easily use them in other projects later.
And I assume that you want to make them static ( @static_method ).
I basically do group utility classes by type, i.e. in your case, one file for dictionaries (with 1 method) and one for the file (having 2 methods). More methods will be added later, but the functionality is grouped by type / usage.
source share