code: def _load_json_module():
      
      first_import_error = None
      for module_name in ['json',
                          'simplejson']:
          try:
              module = __import__(module_name, {}, {}, 'json')
              if not hasattr(module, 'JSONEncoder'):
                  message = (
                      'json library "%s" is not compatible with ProtoRPC' %
                      module_name)
                  logging.warning(message)
                  raise ImportError(message)
              else:
                  return module
          except ImportError as err:
              if not first_import_error:
                  first_import_error = err
  
      logging.error('Must use valid json library (json or simplejson)')
      raise first_import_error
docs: Try to load a valid json module.
  
      There are more than one json modules that might be installed.  They are
      mostly compatible with one another but some versions may be different.
      This function attempts to load various json modules in a preferred order.
      It does a basic check to guess if a loaded version of json is compatible.
  
      Returns:
        Compatible json module.
  
      Raises:
        ImportError if there are no json modules or the loaded json module is
          not compatible with ProtoRPC.