def hb_write(file, m, hb_info=None):
 if (hb_info is None):
  hb_info = HBInfo.from_data(m)
 def _set_matrix(fid):
  hb = HBFile(fid, hb_info)
  return hb.write_matrix(m)
 if isinstance(file, string_types):
  fid = open(file, 'w')
  try:
   return _set_matrix(fid)
  finally:
   fid.close()
 else:
  return _set_matrix(file)

def hb_write ( file , m , hb_info = None ) : if ( hb_info is None ) : hb_info = HBInfo . from_data ( m ) def _set_matrix ( fid ) : hb = HBFile ( fid , hb_info ) return hb . write_matrix ( m ) if isinstance ( file , string_types ) : fid = open ( file , 'w' ) try : return _set_matrix ( fid ) finally : fid . close ( ) else : return _set_matrix ( file )
write hb-format file .