code: def test_safe_get():
      class TestObject:
          def __init__(self, test=None):
              self.test = test
  
          def get_test(self):
              return self.test
  
      test = TestObject()
      test.test = 2
  
      assert safe_get(test, "test") == 2
      assert safe_get(test, "failtest") == "-"
  
file_path: nibabel/nibabel/cmdline/tests/test_utils.py
imports: from io import StringIO
  from os.path import join
  import numpy
  import pytest
  import nibabel
  from nibabel.cmdline.diff import *
  from nibabel.cmdline.utils import *
  from nibabel.testing import data_path
label_desc: Use image node_id 3 for calling a global function with example usage: test_safe_get() and returns: self