code: def _read_legacy_10x_h5(filename, genome=None):
      
      with tables.open_file(str(filename), 'r') as f:
          try:
              children = [x._v_name for x in f.list_nodes(f.root)]
              if not genome:
                  if len(children) > 1:
                      raise ValueError(
                          "'{filename}' contains more than one genome. For legacy 10x h5 "
                          "files you must specify the genome if more than one is present. "
                          "Available genomes are: {avail}"
                          .format(filename=filename, avail=children)
                      )
                  genome = children[0]
              elif genome not in children:
                  raise ValueError(
                      "Could not find genome '{genome}' in '{filename}'. "
                      "Available genomes are: {avail}"
                      .format(
                          genome=genome, filename=str(filename),
                          avail=children,
                      )
                  )
              dsets = {}
              for node in f.walk_nodes('/' + genome, 'Array'):
                  dsets[node.name] = node.read()
              # AnnData works with csr matrices
              # 10x stores the transposed data, so we do the transposition right away
              from scipy.sparse import csr_matrix
              M, N = dsets['shape']
              data = dsets['data']
              if dsets['data'].dtype == np.dtype('int32'):
                  data = dsets['data'].view('float32')
                  data[:] = dsets['data']
              matrix = csr_matrix((data, dsets['indices'], dsets['indptr']),
                                  shape=(N, M))
              # the csc matrix is automatically the transposed csr matrix
              # as scanpy expects it, so, no need for a further transpostion
              adata = AnnData(matrix,
                              {'obs_names': dsets['barcodes'].astype(str)},
                              {'var_names': dsets['gene_names'].astype(str),
                               'gene_ids': dsets['genes'].astype(str)})
              logg.info(t=True)
              return adata
          except KeyError:
              raise Exception('File is missing one or more required datasets.')
docs: Read hdf5 file from Cell Ranger v2 or earlier versions.