code: def maybe_reduce(nodes):
      r
      _, num_nodes = nodes.shape
      if num_nodes < 2:
          return False, nodes
  
      elif num_nodes == 2:
          projection = _PROJECTION0
          denom = _PROJ_DENOM0
      elif num_nodes == 3:
          projection = _PROJECTION1
          denom = _PROJ_DENOM1
      elif num_nodes == 4:
          projection = _PROJECTION2
          denom = _PROJ_DENOM2
      elif num_nodes == 5:
          projection = _PROJECTION3
          denom = _PROJ_DENOM3
      else:
          raise _helpers.UnsupportedDegree(
              num_nodes - 1, supported=(0, 1, 2, 3, 4)
          )
  
      projected = _helpers.matrix_product(nodes, projection) / denom
      relative_err = projection_error(nodes, projected)
      if relative_err < _REDUCE_THRESHOLD:
          return True, reduce_pseudo_inverse(nodes)
  
      else:
          return False, nodes
docs: r"""Reduce nodes in a curve if they are degree-elevated.
  
      .. note::
  
          This is a helper for :func:`_full_reduce`. Hence there is no
          corresponding Fortran speedup.
  
      We check if the nodes are degree-elevated by projecting onto the
      space of degree-elevated curves of the same degree, then comparing
      to the projection. We form the projection by taking the corresponding
      (right) elevation matrix :math:`E` (from one degree lower) and forming
      :math:`E^T \left(E E^T\right)^{-1} E`.
  
      Args:
          nodes (numpy.ndarray): The nodes in the curve.
  
      Returns:
          Tuple[bool, numpy.ndarray]: Pair of values. The first indicates
          if the ``nodes`` were reduced. The second is the resulting nodes,
          either the reduced ones or the original passed in.
  
      Raises:
          .UnsupportedDegree: If the curve is degree 5 or higher.