code: def is_image(obj):
      """Returns true if this object obeys the Image API
  
      This allows us to test for something that is duck-typing an image.
  
      For now an array must have a 'coordmap' attribute, and a callable
      'get_fdata' attribute.
  
      Parameters
      ----------
      obj : object
         object for which to test API
  
      Returns
      -------
      is_img : bool
         True if object obeys image API
  
      Examples
      --------
      >>> from nipy.testing import anatfile
      >>> from nipy.io.api import load_image
      >>> img = load_image(anatfile)
      >>> is_image(img)
      True
      >>> class C(object): pass
      >>> c = C()
      >>> is_image(c)
      False
      """
      if not hasattr(obj, "coordmap") or not hasattr(obj, "metadata"):
          return False
      return callable(getattr(obj, "get_fdata"))
  
imports: import warnings
  from copy import copy
  from itertools import chain
  import numpy
  from nibabel.onetime import auto_attr
  from ..reference.array_coords import ArrayCoordMap
  from ..reference.coordinate_map import AffineTransform, CoordinateSystem, input_axis_index
label_desc: Use image node_id 7 for calling a global function with example usage: is_image(obj) and returns: callable, False