code: def _pre_add_default_dtype_by_casting(cast):
      def _add_default_dtype_by_casting(target=None):
          """Add default dtype as function argument.
  
          Behavior is achieved by casting output (not ideal, but impoosible to
          avoid without acting directly in the backends themselves).
  
          How it works?
          -------------
          Function is called normally. If output is float or complex, then it
          checks if is of expected dtype. If not, cast is performed.
  
          The difference to `_cast_out_from_dtype` is that wrapped functions do
          not accept dtype.
          """
  
          def _decorator(func):
              @functools.wraps(func)
              def _wrapped(*args, dtype=None, **kwargs):
                  if dtype is None:
                      dtype = _config.DEFAULT_DTYPE
  
                  out = func(*args, **kwargs)
                  if out.dtype != dtype:
                      return cast(out, dtype)
                  return out
  
              return _wrapped
  
          if target is None:
              return _decorator
  
          return _decorator(target)
  
      return _add_default_dtype_by_casting
  
file_path: geomstats/geomstats/_backend/_dtype_utils.py
imports: import functools
  import inspect
  import types
  from geomstats._backend import _backend_config
label_desc: Use image node_id 10 for calling a global function with example usage: _pre_add_default_dtype_by_casting(cast) and returns: _add_default_dtype_by_casting, _decorator, _wrapped, _decorator, out, cast