docs: def inject_closure_values(func, **kwargs):
      """
      Returns a new function identical to the previous one except that it acts as
      though global variables named in `kwargs` have been closed over with the
      values specified in the `kwargs` dictionary.
  
      Works on properties, class/static methods and functions.
  
      This can be useful for mocking and other nefarious activities.
      """
      wrapped_by = None
  
      if isinstance(func, property):
          fget, fset, fdel = func.fget, func.fset, func.fdel
          if fget: fget = fix_func(fget, **kwargs)
          if fset: fset = fix_func(fset, **kwargs)
          if fdel: fdel = fix_func(fdel, **kwargs)
          wrapped_by = type(func)
          return wrapped_by(fget, fset, fdel)
  
      elif isinstance(func, (staticmethod, classmethod)):
          func = func.__func__
          wrapped_by = type(func)
  
      newfunc = _inject_closure_values(func, **kwargs)
  
      if wrapped_by:
          newfunc = wrapped_by(newfunc)
      return newfunc