Is the assert necessary? And why not just use 

   import nibabel
   return True

instead of try/except/else