function transformAndValidate({ data, key }) {
  return validate(
    {
      ErrorClass: InvalidResponse,
      prettyErrorMessage: 'invalid key value',
      traceErrorMessage: 'Key value not valid for dynamic badge',
      traceSuccessMessage: 'Key value after validation',
    },
    data[key],
    compoundValueSchema,
  )
}
Look up the value in the data object by key and validate the value against compoundValueSchema.

@param {object} attrs Refer to individual attributes
@param {object} attrs.data Object containing the data for validation
@param {string} attrs.key Key to retrieve the data from object for validation
@throws {InvalidResponse|Error} Error if Joi validation fails due to invalid or no schema
@returns {object} Value if Joi validation is success