docs: def write(file,hdu,order=None,format=None):
      """Write a file in the crazy MOP format given an mop data hdu."""
  
  
      if order or format:
          warnings.warn('Use of <order> and <format> depricated',DeprecationWarning)
  
      ## if the order of the columns isn't constrained just use the keys in what ever order
      data='data'
      if not order:
          if not hdu.has_key('order'):
              hdu['order']=hdu[data].keys()
      else:
          hdu['order']=order
  	
      if not format:
          if not hdu.has_key('format'):
              hdu['format']={}
          for o in hdu['order']:
              if not hdu['format'].has_key(o):
  	       hdu['format'][o]='%10s'
      else:
          hdu['format']=format
  	
      f=open(file,'w')
      kline='## '
      vline='#  '
      header='header'
      num=0
      for keyword in hdu[header]:
          kline+='%10s ' % (keyword, )
          vline+='%10s ' % str(hdu[header][keyword])
          num+=1
          if not ( num % 6 ) :
              num=0
              f.write(kline+'\n')
              f.write(vline+'\n')
              kline='## '
              vline='#  '
      if num > 0:
          f.write(kline+'\n')
          f.write(vline+'\n')
  
      f.write('## ')
      for column in hdu['order']:
          f.write(' %10s' % (column))
      f.write('\n')
      dlen=len(hdu[data][hdu['order'][0]])
      for i in range(dlen):
          f.write('   ')
          for column in hdu['order']:
              f.write(hdu['format'][column] % (hdu[data][column][i]))
              f.write(' ')
          f.write('\n')
      f.close()
      return