code: def validate(cls, mapper_spec):
      
      writer_spec = cls.get_params(mapper_spec, allow_old=False)
  
      # Bucket Name is required
      if cls.BUCKET_NAME_PARAM not in writer_spec:
        raise errors.BadWriterParamsError(
            "%s is required for Google Cloud Storage" %
            cls.BUCKET_NAME_PARAM)
      try:
        cloudstorage.validate_bucket_name(
            writer_spec[cls.BUCKET_NAME_PARAM])
      except ValueError, error:
        raise errors.BadWriterParamsError("Bad bucket name, %s" % (error))
  
      # Validate the naming format does not throw any errors using dummy values
      cls._generate_filename(writer_spec, "name", "id", 0)
      cls._generate_filename(writer_spec, "name", "id", 0, 1, 0)
docs: Validate mapper specification.
  
      Args:
        mapper_spec: an instance of model.MapperSpec.
  
      Raises:
        BadWriterParamsError: if the specification is invalid for any reason such
          as missing the bucket name or providing an invalid bucket name.