def _dmi_cast(key, val, clean=True):
 if (clean and (not _dmi_isclean(key, val))):
  return
 elif (not re.match('serial|part|asset|product', key, flags=re.IGNORECASE)):
  if (',' in val):
   val = [el.strip() for el in val.split(',')]
  else:
   try:
    val = int(val)
   except:
    pass
 return val

def _dmi_cast ( key , val , clean = True ) : if ( clean and ( not _dmi_isclean ( key , val ) ) ) : return elif ( not re . match ( 'serial|part|asset|product' , key , flags = re . IGNORECASE ) ) : if ( ',' in val ) : val = [ el . strip ( ) for el in val . split ( ',' ) ] else : try : val = int ( val ) except : pass return val
simple caster thingy for trying to fish out at least ints & lists from strings .