docs: def load_mgh(filename, to='auto'):
      '''
      load_mgh(filename) yields the MGHImage referened by the given filename by using the
        nibabel.freesurfer.mghformat.load function.
      
      The optional argument 'to' may be used to coerce the resulting data to a particular format; the
      following arguments are understood:
        * 'header' will yield just the image header
        * 'data' will yield the image's data-array
        * 'field' will yield a squeezed version of the image's data-array and will raise an error if
          the data object has more than 2 non-unitary dimensions (appropriate for loading surface
          properties stored in image files)
        * 'affine' will yield the image's affine transformation
        * 'image' will yield the raw image object
        * 'auto' is equivalent to 'image' unless the image has no more than 2 non-unitary dimensions,
          in which case it is assumed to be a surface-field and the return value is equivalent to
          the 'field' value.
      '''
      img = fsmgh.load(filename)
      to = to.lower()
      if to == 'image':    return img
      elif to == 'data':   return img.get_data()
      elif to == 'affine': return img.affine
      elif to == 'header': return img.header
      elif to == 'field':
          dat = np.squeeze(img.get_data())
          if len(dat.shape) > 2:
              raise ValueError('image requested as field has more than 2 non-unitary dimensions')
          return dat
      elif to in ['auto', 'automatic']:
          dims = set(img.dataobj.shape)
          if 1 < len(dims) < 4 and 1 in dims:
              return np.squeeze(img.get_data())
          else:
              return img
      else:
          raise ValueError('unrecognized \'to\' argument \'%s\'' % to)