code: def nvmlStructToFriendlyObject(struct):
      d = {}
      for x in struct._fields_:
          key = x[0]
          value = getattr(struct, key)
          # only need to convert from bytes if bytes, no need to check python version.
          d[key] = value.decode() if isinstance(value, bytes) else value
      obj = nvmlFriendlyObject(d)
      return obj
  
imports: import dataclasses
  import logging
  import os
  import subprocess
  import sys
  import uuid
  from collections import namedtuple
  from ctypes import c_char, c_char_p, c_int, c_uint, c_ulonglong, byref, create_string_buffer, Structure, POINTER, CDLL
  from typing import List, Tuple, Optional, Union
  from ..utils import parse_readable_size
label_desc: Use image node_id 1 for calling a global function with example usage: nvmlStructToFriendlyObject(struct) and returns: obj