code: def sort_indices_by(evals: np.ndarray, z: jnp.ndarray) -> jnp.ndarray:
      lam = len(evals)
      sorted_indices = np.argsort(evals)
      sorted_evals = evals[sorted_indices]
      no_of_feasible_solutions = np.where(sorted_evals != jnp.inf)[
          0
      ].size
      if no_of_feasible_solutions != lam:
          infeasible_z = z[:, np.where(evals == jnp.inf)[0]]
          distances = np.sum(infeasible_z**2, axis=0)
          infeasible_indices = sorted_indices[no_of_feasible_solutions:]
          indices_sorted_by_distance = np.argsort(distances)
          sorted_indices = sorted_indices.at[
              no_of_feasible_solutions:
          ].set(infeasible_indices[indices_sorted_by_distance])
      return sorted_indices
  
imports: import math
  import numpy
  from typing import Union
  from typing import Optional
  import logging
  import jax
  import jax.numpy
  from evojax.algo.base import NEAlgorithm
  from evojax.util import create_logger
label_desc: Use image node_id 3 for calling a global function with example usage: sort_indices_by(evals, z) and returns: sorted_indices