code: def format_kwargs(attrs, params):
      
      attrs_mapping = {'cell_methods': {'YS': 'years', 'MS': 'months'},
                       'long_name': {'YS': 'Annual', 'MS': 'Monthly'}}
  
      for key, val in attrs.items():
          mba = {}
          # Add formatting {} around values to be able to replace them with _attrs_mapping using format.
          for k, v in params.items():
              if isinstance(v, six.string_types) and v in attrs_mapping.get(key, {}).keys():
                  mba[k] = '{' + v + '}'
              else:
                  mba[k] = v
  
          attrs[key] = val.format(**mba).format(**attrs_mapping.get(key, {}))
docs: Modify attribute with argument values.
  
      Parameters
      ----------
      attrs : dict
        Attributes to be assigned to function output. The values of the attributes in braces will be replaced the
        the corresponding args values.
      params : dict
        A BoundArguments.arguments dictionary storing a function's arguments.