def process_attribute_value(key, value):
    """
    Format and process the extra attribute value.
    """
    if not cfg.CONF.log.mask_secrets:
        return value

    blacklisted_attribute_names = (
        MASKED_ATTRIBUTES_BLACKLIST + cfg.CONF.log.mask_secrets_blacklist
    )

    # NOTE: This can be expensive when processing large dicts or objects
    if isinstance(value, SIMPLE_TYPES):
        if key in blacklisted_attribute_names:
            value = MASKED_ATTRIBUTE_VALUE
    elif isinstance(value, dict):
        # Note: We don't want to modify the original value
        value = fast_deepcopy_dict(value)

        for dict_key, dict_value in six.iteritems(value):
            value[dict_key] = process_attribute_value(key=dict_key, value=dict_value)

    return value

    Format and process the extra attribute value.
    
st2common/st2common/logging/formatters.py