code: def _from_derivatives(
      xi,
      yi,
      x,
      order=None,
      der: int | list[int] | None = 0,
      extrapolate: bool = False,
  ):
      """
      Convenience function for interpolate.BPoly.from_derivatives.
  
      Construct a piecewise polynomial in the Bernstein basis, compatible
      with the specified values and derivatives at breakpoints.
  
      Parameters
      ----------
      xi : array-like
          sorted 1D array of x-coordinates
      yi : array-like or list of array-likes
          yi[i][j] is the j-th derivative known at xi[i]
      order: None or int or array-like of ints. Default: None.
          Specifies the degree of local polynomials. If not None, some
          derivatives are ignored.
      der : int or list
          How many derivatives to extract; None for all potentially nonzero
          derivatives (that is a number equal to the number of points), or a
          list of derivatives to extract. This number includes the function
          value as 0th derivative.
       extrapolate : bool, optional
          Whether to extrapolate to ouf-of-bounds points based on first and last
          intervals, or to return NaNs. Default: True.
  
      See Also
      --------
      scipy.interpolate.BPoly.from_derivatives
  
      Returns
      -------
      y : scalar or array-like
          The result, of length R or length M or M by R.
      """
      from scipy import interpolate
  
      # return the method for compat with scipy version & backwards compat
      method = interpolate.BPoly.from_derivatives
      m = method(
          xi, yi.reshape(-1, 1), orders=order, extrapolate=extrapolate
      )
  
      return m(x)
  
imports: from __future__ import annotations
  from functools import partial, wraps
  from typing import TYPE_CHECKING, Any, cast
  import numpy
  from pandas._libs import NaT, algos, lib
  from pandas._typing import ArrayLike, Axis, AxisInt, F, npt
  from pandas.compat._optional import import_optional_dependency
  from pandas.core.dtypes.cast import infer_dtype_from
  from pandas.core.dtypes.common import is_array_like, is_numeric_v_string_like, is_object_dtype, needs_i8_conversion
  from pandas.core.dtypes.missing import is_valid_na_for_dtype, isna, na_value_for_dtype
label_desc: Use image node_id 11 for calling a global function with example usage: _from_derivatives(xi, yi, x, order, der, extrapolate) and returns: m