Factor out logic to determine if something is called by a particular nam...

...e into a function.