@classmethod
  def JsonCorsToMessageEntries(cls, json_cors):
    """Translates CORS JSON to an apitools message.

    Args:
      json_cors: JSON string representing CORS configuration.

    Returns:
      List of apitools Bucket.CorsValueListEntry. An empty list represents
      no CORS configuration.
    """
    try:
      deserialized_cors = json.loads(json_cors)
      cors = []
      for cors_entry in deserialized_cors:
        cors.append(encoding.DictToMessage(
            cors_entry, apitools_messages.Bucket.CorsValueListEntry))
      return cors
    except __HOLE__:
      CheckForXmlConfigurationAndRaise('CORS', json_cors)
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/translation_helper.py/CorsTranslation.JsonCorsToMessageEntries