refactoring completion functions a bit to make it easier to add display-mode features
add simple python function to handle display-mode locations