def hb_read(file):
 def _get_matrix(fid):
  hb = HBFile(fid)
  return hb.read_matrix()
 if isinstance(file, string_types):
  fid = open(file)
  try:
   return _get_matrix(fid)
  finally:
   fid.close()
 else:
  return _get_matrix(file)

def hb_read ( file ) : def _get_matrix ( fid ) : hb = HBFile ( fid ) return hb . read_matrix ( ) if isinstance ( file , string_types ) : fid = open ( file ) try : return _get_matrix ( fid ) finally : fid . close ( ) else : return _get_matrix ( file )
read hb-format file .