code: def apply_product_config(config):
      
      cot_product = config['cot_product']
  
      for key in config:
          if isinstance(config[key], Mapping) and 'by-cot-product' in config[key]:
              try:
                  config[key] = config[key]['by-cot-product'][cot_product]
              except KeyError:
                  raise ConfigError("Product {} not specified for key {}".format(cot_product, key))
  
      return config
docs: Apply config values that are keyed by `cot_product`.
  
      This modifies the passed in configuration.
  
      Args:
          config dict: the config to apply cot_product keying too
  
      Returns: dict