code: def parseversion(self, raw_version):
      import packaging
  
      raw_version = raw_version.rsplit(" ", 1)[-1]
      if raw_version.startswith("v"):
          raw_version = raw_version[1:]
  
      parsed_version = None
      trimend = len(raw_version)
      while parsed_version is None:
          try:
              parsed_version = packaging.version.Version(
                  raw_version[:trimend]
              )
          except packaging.version.InvalidVersion:
              trimend = trimend - 1
              if trimend == 0:
                  raise WorkflowError(
                      f"Apptainer/Singularity version cannot be parsed: {raw_version}"
                  )
      return parsed_version
  
imports: from pathlib import Path
  import subprocess
  import shutil
  import os
  import hashlib
  from snakemake.common import get_snakemake_searchpaths, is_local_file, parse_uri
  from snakemake.exceptions import WorkflowError
  from snakemake.logging import logger
  from snakemake_interface_common.utils import lazy_property
label_desc: Use image node_id 4 for calling the Singularity obj's underlying member method code with example usage: obj.parseversion(raw_version) and returns: parsed_version