<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getStateIndex(self,state):
 """ Returns the index of a state by calculating the state code and searching for this code a sorted list. Can be called on multiple states at once. """

        statecodes = self.getStateCode(state)
        return np.searchsorted(self.codes,statecodes).astype(int)