<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def config(name, config, edit=True):
    '''
    Create VirtualHost configuration files

    name
        File for the virtual host
    config
        VirtualHost configurations

    .. note::

        This function is not meant to be used from the command line.
        Config is meant to be an ordered dict of all of the apache configs.

    CLI Example:

    .. code-block:: bash

        salt '*' apache.config /etc/httpd/conf.d/ports.conf config="[{'Listen': '22'}]"
    '''

    configs = []
    for entry in config:
        key = next(six.iterkeys(entry))
        configs.append(_parse_config(entry[key], key))

    # Python auto-correct line endings
    configstext = '\n'.join(salt.utils.data.decode(configs))
    if edit:
        with salt.utils.files.fopen(name, 'w') as configfile:
            configfile.write('# This file is managed by Salt.\n')
            configfile.write(salt.utils.stringutils.to_str(configstext))
    return configstext