code: def read_hdf(filename: PathLike, key: str) -> AnnData:
      
      with h5py.File(filename, 'r') as f:
          # the following is necessary in Python 3, because only
          # a view and not a list is returned
          keys = [k for k in f.keys()]
          if key == '':
              raise ValueError((
                  'The file {} stores the following sheets:\n{}\n'
                  'Call read/read_hdf5 with one of them.'
              ).format(filename, keys))
          # read array
          X = f[key][()]
          # try to find row and column names
          rows_cols = [{}, {}]
          for iname, name in enumerate(['row_names', 'col_names']):
              if name in keys:
                  rows_cols[iname][name] = f[name][()]
      adata = AnnData(X, rows_cols[0], rows_cols[1], dtype=X.dtype.name)
      return adata
docs: Read ``.h5`` (hdf5) file.
  
      Note: Also looks for fields ``row_names`` and ``col_names``.
  
      Parameters
      ----------
      filename
          Filename of data file.
      key
          Name of dataset in the file.