code: def get_cpu_info():
      cpuinfo = []
      args = ["lscpu", "--parse=CPU,Core,Socket"]
      lscpu_info = subprocess.check_output(
          args, universal_newlines=True
      ).split("\n")
  
      # Get information about  cpu, core, socket and node
      for line in lscpu_info:
          pattern = r"^([\d]+,[\d]+,[\d]+)"
          regex_out = re.search(pattern, line)
          if regex_out:
              cpuinfo.append(regex_out.group(1).strip().split(","))
  
      get_physical_core = {}
      get_socket = {}
  
      for line in cpuinfo:
          int_line = [int(x) for x in line]
          l_id, p_id, s_id = int_line
          get_physical_core[l_id] = p_id
          get_socket[l_id] = s_id
  
      return get_physical_core, get_socket
  
imports: import subprocess
  import re
  from typing import Optional
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 2 for calling a global function with example usage: get_cpu_info() and returns: get_physical_core,  get_socket