def get_config(lines):
    """Recursive function that iterates over the hierarchical Lineobjs
    to produce a flat list of config lines.

    Args:
        lines (list): A list of Lineobjs.

            | The Lineobjs in this list are expected to have subs[] set
              to properly represent the config hierarchy.

    Returns:
        list: A *flat* sorted list of config lines that can be used with fh.writelines()
            to write to a configuration file.
    """
    config = []
    for line in sorted(lines, key=lambda k: k.text):
        config.append(line.text)
        config.extend(get_config(line.subs))
    return config