code: def _get_unicode_robust_version(f):
      @wraps(f)
      def wrapped(*args, **kwargs):
          try:
              return f(*args, **kwargs)
          except UnicodeEncodeError:
              return f(ensure_bytes(*args, **kwargs))
  
      doc = getattr(f, "__doc__", None)
      # adjust only if __doc__ is not completely absent (None)
      if doc is not None:
          wrapped.__doc__ = (
              doc
              + "\n\nThis wrapper around original function would encode forcefully "
              "to utf-8 if initial invocation fails"
          )
      return wrapped
  
file_path: datalad/datalad/support/path.py
imports: from __future__ import annotations
  import os
  import os.path
  from collections import defaultdict
  from collections.abc import Iterable, Iterator
  from functools import wraps
  from itertools import dropwhile
  from pathlib import Path, PurePosixPath
  from ..utils import ensure_bytes, getpwd
label_desc: Use image node_id 1 for calling a global function with example usage: _get_unicode_robust_version(f) and returns: wrapped, f, f