In order to prepare for introduction of fallbacks, refactor the function to return its status as an enumeration value. Also, move the index range check inside the function from python-specific code.
In order to prepare for introduction of fallbacks, refactor the function to return its status as an enumeration value. Also, move the index range check inside the function from python-specific code.