Why are you defining this function in multiple places? Find one place to define it and import it where you need it.