def docstring_parameter(**kwargs):
    """ Decorates a function to update the docstring with a variable. This
    allows the use of (global) variables in docstrings.

    Example:
        @docstring_parameter(config_file=CONFIG_FILE)
        myfunc():
        \"\"\" The config file is {config_file} \"\"\"

    Args:
        **kwargs: Declarations of string formatters.

    Raises:
        KeyError: If formatters are not found in the docstring.
    """
    def decorate(obj):
        obj.__doc__ = obj.__doc__.format(**kwargs)
        return obj
    return decorate