docstr: Get information from SPE file header
  
  Parameters
  ----------
  spec
      Maps header entry name to its location, data type description and
      optionally number of entries. See :py:attr:`Spec.basic` and
      :py:attr:`Spec.metadata`.
  char_encoding
      String character encoding
  
  Returns
  -------
  Dict mapping header entry name to its value
docstr_tok: ["Get","information","from","SPE","file","header","Parameters","--","--","--","--","--","spec","Maps","header","entry","name","to","its","location",",","data","type","description","and","optionally","number","of","entries",".","See",":","py",":","attr",":","`","Spec.basic","`","and",":","py",":","attr",":","`","Spec.metadata","`",".","char_encoding","String","character","encoding","Returns","--","--","--","-","Dict","mapping","header","entry","name","to","its","value"]
code: def _parse_header(
      self, spec: Mapping[str, Tuple], char_encoding: str
  ) -> Dict[str, Any]:
      """Get information from SPE file header
  
      Parameters
      ----------
      spec
          Maps header entry name to its location, data type description and
          optionally number of entries. See :py:attr:`Spec.basic` and
          :py:attr:`Spec.metadata`.
      char_encoding
          String character encoding
  
      Returns
      -------
      Dict mapping header entry name to its value
      """
  
      ret = {}
      # Decode each string from the numpy array read by np.fromfile
      decode = np.vectorize(lambda x: x.decode(char_encoding))
  
      for name, sp in spec.items():
          self._file.seek(sp[0])
          cnt = 1 if len(sp) < 3 else sp[2]
          v = np.fromfile(self._file, dtype=sp[1], count=cnt)
          if v.dtype.kind == "S" and name not in Spec.no_decode:
              # Silently ignore string decoding failures
              try:
                  v = decode(v)
              except Exception:
                  warnings.warn(
                      f'Failed to decode "{name}" metadata '
                      "string. Check `char_encoding` parameter."
                  )
  
          try:
              # For convenience, if the array contains only one single
              # entry, return this entry itself.
              v = v.item()
          except ValueError:
              v = np.squeeze(v)
          ret[name] = v
      return ret
  
imports: from datetime import datetime
  import logging
  import os
  from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Union
  import warnings
  import numpy
  from ..core.request import Request, IOMode, InitializationError
  from ..core.v3_plugin_api import PluginV3, ImageProperties
label_desc: Use image node_id 8 for calling the SpePlugin obj's underlying member method code with example usage: obj._parse_header(spec, char_encoding) and returns: ret