And refactor it as a function.
procutil.py is the more appropriate location for this code, as
procutil is responsible for managing aspects of the executable
environment.
The impetus for this change is introducing an abstraction for
resource reading. I'd like that code to live in procutil.py
so we don't make util.py any larger. The code requires datapath.
And since util imports procutil, we need datapath in procutil
to avoid a cycle.