class_docstr: Base class for common HDF4 operations.
class_docstr_tok: ["Base","class","for","common","HDF4","operations","."]
code: def _collect_attrs(self, name, attrs):
      for key, value in attrs.items():
          value = np.squeeze(value)
          if (
              issubclass(value.dtype.type, (np.bytes_, np.str_))
              and not value.shape
          ):
              value = value.item()  # convert to scalar
              if not isinstance(value, str):
                  # python 3 - was scalar numpy array of bytes
                  # otherwise python 2 - scalar numpy array of 'str'
                  value = value.decode()
              self.file_content["{}/attr/{}".format(name, key)] = value
          elif not value.shape:
              # convert to a scalar
              self.file_content[
                  "{}/attr/{}".format(name, key)
              ] = value.item()
          else:
              self.file_content["{}/attr/{}".format(name, key)] = value
  
file_path: satpy/satpy/readers/hdf4_utils.py
imports: import logging
  import dask.array
  import numpy
  import xarray
  from pyhdf.SD import SD, SDC, SDS
  from satpy.readers.file_handlers import BaseFileHandler
  from satpy.utils import get_legacy_chunk_size
label_desc: Use image node_id 2 for calling the HDF4FileHandler obj's underlying member method code with example usage: obj._collect_attrs(name, attrs) without return types