code: def _get_key2sl(key):
      
      if isinstance(key, (int, farray)) or key is Ellipsis:
          return key
      elif isinstance(key, slice):
          # Forbid slice steps
          if key.step is not None:
              raise ValueError("farray slice step is not supported")
          return key
      elif isinstance(key, boolfunc.Function):
          return farray([key])
      else:
          raise TypeError("expected int, slice, Function, farray, or ...")
docs: Convert a key part to a slice part.