code: def insert(x, tck, m=1, per=0):
      """
      Insert knots into a B-spline.
  
      Given the knots and coefficients of a B-spline representation, create a
      new B-spline with a knot inserted `m` times at point `x`.
      This is a wrapper around the FORTRAN routine insert of FITPACK.
  
      Parameters
      ----------
      x (u) : array_like
          A 1-D point at which to insert a new knot(s).  If `tck` was returned
          from ``splprep``, then the parameter values, u should be given.
      tck : a `BSpline` instance or a tuple
          If tuple, then it is expected to be a tuple (t,c,k) containing
          the vector of knots, the B-spline coefficients, and the degree of
          the spline.
      m : int, optional
          The number of times to insert the given knot (its multiplicity).
          Default is 1.
      per : int, optional
          If non-zero, the input spline is considered periodic.
  
      Returns
      -------
      BSpline instance or a tuple
          A new B-spline with knots t, coefficients c, and degree k.
          ``t(k+1) <= x <= t(n-k)``, where k is the degree of the spline.
          In case of a periodic spline (``per != 0``) there must be
          either at least k interior knots t(j) satisfying ``t(k+1)<t(j)<=x``
          or at least k interior knots t(j) satisfying ``x<=t(j)<t(n-k)``.
          A tuple is returned iff the input argument `tck` is a tuple, otherwise
          a BSpline object is constructed and returned.
  
      Notes
      -----
      Based on algorithms from [1]_ and [2]_.
  
      Manipulating the tck-tuples directly is not recommended. In new code,
      prefer using the `BSpline` objects.
  
      References
      ----------
      .. [1] W. Boehm, "Inserting new knots into b-spline curves.",
          Computer Aided Design, 12, p.199-201, 1980.
      .. [2] P. Dierckx, "Curve and surface fitting with splines, Monographs on
          Numerical Analysis", Oxford University Press, 1993.
  
      Examples
      --------
      You can insert knots into a B-spline.
  
      >>> from scipy.interpolate import splrep, insert
      >>> x = np.linspace(0, 10, 5)
      >>> y = np.sin(x)
      >>> tck = splrep(x, y)
      >>> tck[0]
      array([ 0.,  0.,  0.,  0.,  5., 10., 10., 10., 10.])
  
      A knot is inserted:
  
      >>> tck_inserted = insert(3, tck)
      >>> tck_inserted[0]
      array([ 0.,  0.,  0.,  0.,  3.,  5., 10., 10., 10., 10.])
  
      Some knots are inserted:
  
      >>> tck_inserted2 = insert(8, tck, m=3)
      >>> tck_inserted2[0]
      array([ 0.,  0.,  0.,  0.,  5.,  8.,  8.,  8., 10., 10., 10., 10.])
  
      """
      if isinstance(tck, BSpline):
          t, c, k = tck.tck
  
          # FITPACK expects the interpolation axis to be last, so roll it over
          # NB: if c array is 1D, transposes are no-ops
          sh = tuple(range(c.ndim))
          c = c.transpose(sh[1:] + (0,))
          t_, c_, k_ = _impl.insert(x, (t, c, k), m, per)
  
          # and roll the last axis back
          c_ = np.asarray(c_)
          c_ = c_.transpose((sh[-1],) + sh[:-1])
          return BSpline(t_, c_, k_)
      else:
          return _impl.insert(x, tck, m, per)
  
file_path: catboost/contrib/python/scipy/py3/scipy/interpolate/fitpack.py
imports: import warnings
  import numpy
  from ._fitpack_impl import bisplrep, bisplev, dblint
  from .None import _fitpack_impl
  from ._bsplines import BSpline
label_desc: Use image node_id 7 for calling a global function with example usage: insert(x, tck, m, per) and returns: BSpline, _impl