code: def _update(s, _lambda, P):
      """
      Update ``P`` such that for the updated `P'` `P' v = e_{s}`.
      """
      k = min([j for j in range(s, len(_lambda)) if _lambda[j] != 0])
  
      for r in range(len(_lambda)):
          if r != k:
              P[r] = [
                  P[r][j] - (P[k][j] * _lambda[r]) / _lambda[k]
                  for j in range(len(P[r]))
              ]
  
      P[k] = [P[k][j] / _lambda[k] for j in range(len(P[k]))]
      P[k], P[s] = P[s], P[k]
  
      return P
  
file_path: sympy/sympy/polys/fglmtools.py
imports: from sympy.polys.monomials import monomial_mul, monomial_div
label_desc: Use image node_id 5 for calling a global function with example usage: _update(s, _lambda, P) and returns: P