code: def from_hdf5(cls, filename, dataset_name=None, group_name=None):
          r
          from unyt._on_demand_imports import _h5py as h5py
          import pickle
  
          if dataset_name is None:
              dataset_name = "array_data"
  
          f = h5py.File(filename)
          if group_name is not None:
              g = f[group_name]
          else:
              g = f
          dataset = g[dataset_name]
          data = dataset[:]
          units = dataset.attrs.get("units", "")
          unit_lut = pickle.loads(dataset.attrs["unit_registry"].tostring())
          f.close()
          registry = UnitRegistry(lut=unit_lut, add_default_symbols=False)
          return cls(data, units, registry=registry)
docs: r"""Attempts read in and convert a dataset in an hdf5 file into a
          unyt_array.
  
          Parameters
          ----------
          filename: string
          The filename to of the hdf5 file.
  
          dataset_name: string
              The name of the dataset to read from.  If the dataset has a units
              attribute, attempt to infer units as well.
  
          group_name: string
              An optional group to read the arrays from. If not specified, the
              arrays are datasets at the top level by default.