avoid executing code in utils.localinterfaces at import time

moves away from global constants to utility functions.

The code is still only executed once, but instead of at import time, it is executed the first time it is needed.