docstr: Retrieves the version of a Python package by importing the package
  and printing the ``__version__`` value.
  
  Returns `None` if the package version cannot be printed.
docstr_tok: ["Retrieves","the","version","of","a","Python","package","by","importing","the","package","and","printing","the","``","__version__","``","value",".","Returns","`","None","`","if","the","package","version","can","not","be","printed","."]
code: def get_from_python(self, lookup: str, key=None):
      """Retrieves the version of a Python package by importing the package
      and printing the ``__version__`` value.
  
      Returns `None` if the package version cannot be printed.
      """
      if key is None:
          key = lookup
      self.contdata[key] = self.ERROR
      p = subprocess.run(  # nosec B602
          f"python -c 'import {lookup} as x; print(x.__version__);'",
          shell=True,
          capture_output=True,
          check=False,
      )
      result = p.stdout.decode("utf-8")
      if p.returncode != 0:
          logger.info(
              "Failed to get '%s' package version from python: %s",
              lookup,
              result,
          )
          return
      for line in result.split("\n"):
          if VersionInfo.isvalid(line):
              result = line
              break
      self.contdata[key] = result.strip()
  
imports: import argparse
  import json
  import logging
  import os
  import subprocess
  import sys
  from collections import defaultdict
  from datetime import date
  from datetime import datetime
  from pathlib import Path
  import yaml
  from github import Github
  from github.GithubException import GithubException
  from github.GitRef import GitRef
  from semver import VersionInfo
label_desc: Use image node_id 5 for calling the SupportMatrixExtractor obj's underlying member method code with example usage: obj.get_from_python(lookup, key) without return types