I have this block of code in several files of my project and I know it is bad practice to repeat codes. So I decided to write a function in a different file to return the de