code: def GetEccByType(handle, counterType, errorType):
      strResult = ""
  
      try:
          deviceMemory = nvmlDeviceGetMemoryErrorCounter(
              handle,
              errorType,
              counterType,
              NVML_MEMORY_LOCATION_DEVICE_MEMORY,
          )
      except NVMLError as err:
          deviceMemory = handleError(err)
      strResult += (
          "          <device_memory>"
          + str(deviceMemory)
          + "</device_memory>\n"
      )
  
      try:
          registerFile = nvmlDeviceGetMemoryErrorCounter(
              handle,
              errorType,
              counterType,
              NVML_MEMORY_LOCATION_REGISTER_FILE,
          )
      except NVMLError as err:
          registerFile = handleError(err)
  
      strResult += (
          "          <register_file>"
          + str(registerFile)
          + "</register_file>\n"
      )
  
      try:
          l1Cache = nvmlDeviceGetMemoryErrorCounter(
              handle,
              errorType,
              counterType,
              NVML_MEMORY_LOCATION_L1_CACHE,
          )
      except NVMLError as err:
          l1Cache = handleError(err)
      strResult += (
          "          <l1_cache>" + str(l1Cache) + "</l1_cache>\n"
      )
  
      try:
          l2Cache = nvmlDeviceGetMemoryErrorCounter(
              handle,
              errorType,
              counterType,
              NVML_MEMORY_LOCATION_L2_CACHE,
          )
      except NVMLError as err:
          l2Cache = handleError(err)
      strResult += (
          "          <l2_cache>" + str(l2Cache) + "</l2_cache>\n"
      )
  
      try:
          textureMemory = nvmlDeviceGetMemoryErrorCounter(
              handle,
              errorType,
              counterType,
              NVML_MEMORY_LOCATION_TEXTURE_MEMORY,
          )
      except NVMLError as err:
          textureMemory = handleError(err)
      strResult += (
          "          <texture_memory>"
          + str(textureMemory)
          + "</texture_memory>\n"
      )
  
      try:
          count = str(
              nvmlDeviceGetTotalEccErrors(
                  handle, errorType, counterType
              )
          )
      except NVMLError as err:
          count = handleError(err)
      strResult += "          <total>" + count + "</total>\n"
  
      return strResult
  
file_path: py3nvml/py3nvml/nvidia_smi.py
imports: from .py3nvml import *
  import datetime
  import warnings
  import logging
  import os
label_desc: Use image node_id 1 for calling a global function with example usage: GetEccByType(handle, counterType, errorType) and returns: strResult