class_docstr: Extract metadata written by the SDT-control software
  
  Some of it is encoded in the comment strings
  (see :py:meth:`parse_comments`). Also, date and time are encoded in a
  peculiar way (see :py:meth:`get_datetime`). Use :py:meth:`extract_metadata`
  to update the metadata dict.
docstr: Extract SDT-control metadata from comments
  
  Parameters
  ----------
  comments
      List of SPE file comments, typically ``metadata["comments"]``.
  version
      Major and minor version of SDT-control metadata format
  
  Returns
  -------
  Dict of metadata
docstr_tok: ["Extract","SDT-control","metadata","from","comments","Parameters","--","--","--","--","--","comments","List","of","SPE","file","comments",",","typically","``","metadata","[","``","comments","''","]","``",".","version","Major","and","minor","version","of","SDT-control","metadata","format","Returns","--","--","--","-","Dict","of","metadata"]
code: def parse_comments(
      comments: Sequence[str], version: Tuple[int, int]
  ) -> Dict[str, Any]:
      """Extract SDT-control metadata from comments
  
      Parameters
      ----------
      comments
          List of SPE file comments, typically ``metadata["comments"]``.
      version
          Major and minor version of SDT-control metadata format
  
      Returns
      -------
      Dict of metadata
      """
      sdt_md = {}
      for minor in range(version[1] + 1):
          # Metadata with same major version is backwards compatible.
          # Fields are specified incrementally in `comment_fields`.
          # E.g. if the file has version 5.01, `comment_fields[5, 0]` and
          # `comment_fields[5, 1]` need to be decoded.
          try:
              cmt = __class__.comment_fields[version[0], minor]
          except KeyError:
              continue
          for name, spec in cmt.items():
              try:
                  v = spec.cvt(comments[spec.n][spec.slice])
                  if spec.scale is not None:
                      v *= spec.scale
                  sdt_md[name] = v
              except Exception as e:
                  warnings.warn(
                      f"Failed to decode SDT-control metadata field `{name}`: {e}"
                  )
                  sdt_md[name] = None
      if version not in __class__.comment_fields:
          supported_ver = ", ".join(
              map(
                  lambda x: f"{x[0]}.{x[1]:02}",
                  __class__.comment_fields,
              )
          )
          warnings.warn(
              f"Unsupported SDT-control metadata version {version[0]}.{version[1]:02}. "
              f"Only versions {supported_ver} are supported. "
              "Some or all SDT-control metadata may be missing."
          )
      comment = comments[0] + comments[2]
      sdt_md["comment"] = comment.strip()
      return sdt_md
  
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 2 for calling the SDTControlSpec obj's underlying member method code with example usage: obj.parse_comments(comments, version) and returns: sdt_md