def save(name, data, rc_file='~/.odoorpcrc'):
    """Save the `data` session configuration under the name `name`
    in the `rc_file` file.

    >>> import odoorpc
    >>> odoorpc.session.save(
    ...     'foo',
    ...     {'type': 'ODOO', 'host': 'localhost', 'protocol': 'jsonrpc',
    ...      'port': 8069, 'timeout': 120, 'database': 'db_name'
    ...      'user': 'admin', 'passwd': 'password'})    # doctest: +SKIP

    .. doctest::
        :hide:

        >>> import odoorpc
        >>> session = '%s_session' % DB
        >>> odoorpc.session.save(
        ...     session,
        ...     {'type': 'ODOO', 'host': HOST, 'protocol': PROTOCOL,
        ...      'port': PORT, 'timeout': 120, 'database': DB,
        ...      'user': USER, 'passwd': PWD})
    """
    conf = ConfigParser()
    conf.read([os.path.expanduser(rc_file)])
    if not conf.has_section(name):
        conf.add_section(name)
    for key in data:
        value = data[key]
        conf.set(name, key, str(value))
    with open(os.path.expanduser(rc_file), 'w') as file_:
        os.chmod(os.path.expanduser(rc_file), stat.S_IREAD | stat.S_IWRITE)
        conf.write(file_)