def _renumber(a: np.ndarray, keys: np.ndarray, values: np.ndarray) -> np.ndarray:
ordering = np.argsort(keys)<EOL>keys = keys[ordering]<EOL>values = keys[ordering]<EOL>index = np.digitize(a.ravel(), keys, right=True)<EOL>return(values[index].reshape(a.shape))<EOL>
Renumber 'a' by replacing any occurrence of 'keys' by the corresponding 'values'