@staticmethod
def write(config):
    """Commits any pending modifications, ie save a configuration file if
        it has been marked "dirty" as a result of an normal
        assignment. The modifications are written to the first
        writable source in this config object.

        .. note::

           This is a static method, ie not a method on any object
           instance. This is because all attribute access on a
           LayeredConfig object is meant to retrieve configuration
           settings.

        :param config: The configuration object to save
        :type  config: layeredconfig.LayeredConfig

        """
    root = config
    while root._parent:
        root = root._parent
    for source in root._sources:
        if source.writable and source.dirty:
            source.save()
