code: def safe_get(obj, name):
      """A getattr which would return '-' if getattr fails"""
      try:
          f = getattr(obj, "get_" + name)
          return f()
      except Exception as e:
          verbose(2, f"get_{name}() failed -- {e}")
          return "-"
  
file_path: nibabel/nibabel/cmdline/utils.py
imports: import re
  from io import StringIO
  from math import ceil
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: safe_get(obj, name) and returns: f, str