def parse_troubleshooting(troubleshooting_json):
 if (not troubleshooting_json):
  return None
 try:
  parsed = json.loads(troubleshooting_json)
 except ValueError:
  return None
 spec = (((), dict), (('accessibility',), dict), (('accessibility', 'isActive'), bool), (('application',), dict), (('application', 'name'), basestring), (('application', 'supportURL'), basestring), (('application', 'userAgent'), basestring), (('application', 'version'), basestring), (('extensions',), list), (('graphics',), dict), (('javaScript',), dict), (('modifiedPreferences',), dict), (('userJS',), dict), (('userJS', 'exists'), bool))
 for (path, type_) in spec:
  item = parsed
  for piece in path:
   item = item.get(piece)
   if (item is None):
    return None
  if (not isinstance(item, type_)):
   return None
 parsed['modifiedPreferences'] = dict(((key, val) for (key, val) in parsed['modifiedPreferences'].items() if (not key.startswith('print'))))
 return parsed

def parse_troubleshooting ( troubleshooting_json ) : if ( not troubleshooting_json ) : return None try : parsed = json . loads ( troubleshooting_json ) except ValueError : return None spec = ( ( ( ) , dict ) , ( ( 'accessibility' , ) , dict ) , ( ( 'accessibility' , 'isActive' ) , bool ) , ( ( 'application' , ) , dict ) , ( ( 'application' , 'name' ) , basestring ) , ( ( 'application' , 'supportURL' ) , basestring ) , ( ( 'application' , 'userAgent' ) , basestring ) , ( ( 'application' , 'version' ) , basestring ) , ( ( 'extensions' , ) , list ) , ( ( 'graphics' , ) , dict ) , ( ( 'javaScript' , ) , dict ) , ( ( 'modifiedPreferences' , ) , dict ) , ( ( 'userJS' , ) , dict ) , ( ( 'userJS' , 'exists' ) , bool ) ) for ( path , type_ ) in spec : item = parsed for piece in path : item = item . get ( piece ) if ( item is None ) : return None if ( not isinstance ( item , type_ ) ) : return None parsed [ 'modifiedPreferences' ] = dict ( ( ( key , val ) for ( key , val ) in parsed [ 'modifiedPreferences' ] . items ( ) if ( not key . startswith ( 'print' ) ) ) ) return parsed
normalizes the troubleshooting data from question .