class_docstr: Template class to implement header protocol
code: def from_header(
      klass: type[HdrT],
      header: FileBasedHeader | ty.Mapping | None = None,
  ) -> HdrT:
      if header is None:
          return klass()
      # I can't do isinstance here because it is not necessarily true
      # that a subclass has exactly the same interface as its parent
      # - for example Nifti1Images inherit from Analyze, but have
      # different field names
      if type(header) == klass:
          return header.copy()
      raise NotImplementedError(
          f"Header class requires a conversion from {klass} to {type(header)}"
      )
  
imports: from __future__ import annotations
  import io
  import typing
  from copy import deepcopy
  from urllib import request
  from ._compression import COMPRESSION_ERRORS
  from .fileholders import FileHolder, FileMap
  from .filename_parser import TypesFilenamesError, _stringify_path, splitext_addext, types_filenames
  from .openers import ImageOpener
label_desc: Use image node_id 1 for calling the FileBasedHeader obj's underlying member method code with example usage: obj.from_header(klass, header) and returns: klass, header