docs: def to_image_header(img):
      '''
      to_image_header(img) yields img.header if img is a nibabel image object.
      to_image_header(hdr) yields hdr if hdr is a nibabel header object.
      to_image_header(obj) raises an error for other input types.
      '''
      if not img.__module__.startswith('nibabel.'):
          raise ValueError('to_image_header: only nibabel obejcts can be coerced to headers')
      if type(img).__name__.endswith('Header'): return img
      # if not a header given, must be an image given:
      try: return img.header
      except Exception:
          raise ValueError('to_image_header: can only convert nibabel image or header objects')