code: def multiplicity(ctx, f, root, tol=None, maxsteps=10, **kwargs):
      """
      Return the multiplicity of a given root of f.
  
      Internally, numerical derivatives are used. This might be inefficient for
      higher order derviatives. Due to this, ``multiplicity`` cancels after
      evaluating 10 derivatives by default. You can be specify the n-th derivative
      using the dnf keyword.
  
      >>> from mpmath import *
      >>> multiplicity(lambda x: sin(x) - 1, pi/2)
      2
  
      """
      if tol is None:
          tol = ctx.eps**0.8
      kwargs["d0f"] = f
      for i in xrange(maxsteps):
          dfstr = "d" + str(i) + "f"
          if dfstr in kwargs:
              df = kwargs[dfstr]
          else:
              df = lambda x: ctx.diff(f, x, i)
          if not abs(df(root)) < tol:
              break
      return i
  
imports: from __future__ import print_function
  from copy import copy
  from ..libmp.backend import xrange
label_desc: Use image node_id 6 for calling a global function with example usage: multiplicity(ctx, f, root, tol, maxsteps) and returns: i