code: def astype(self, type_name):
          
          if type_name == 'nddata':
              return self.as_nddata()
  
          if type_name == 'hdu':
              return self.as_hdu()
  
          raise ValueError("Unrecognized conversion type '%s'" % (type_name))
docs: Convert AstroImage object to some other kind of object.