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

def save_inventory(inventory, hosts_file=HOSTS_FILE):
    '''Saves Ansible inventory to file.

    Parameters
    ----------
    inventory: ConfigParser.SafeConfigParser
        content of the `hosts_file`
    hosts_file: str, optional
        path to Ansible hosts file
    '''
    with open(hosts_file, 'w') as f:
        inventory.write(f)