Retrieve whole structure from an ini file and return it as dictionary.

    API Example:

    .. code-block:: python

        import salt
        sc = salt.client.get_local_client()
        sc.cmd('target', 'ini.get_ini',
               [path_to_ini_file])

    CLI Example:

    .. code-block:: bash

        salt '*' ini.get_ini /path/to/ini

def get_ini(file_name, separator='='):
    '''
    Retrieve whole structure from an ini file and return it as dictionary.

    API Example:

    .. code-block:: python

        import salt
        sc = salt.client.get_local_client()
        sc.cmd('target', 'ini.get_ini',
               [path_to_ini_file])

    CLI Example:

    .. code-block:: bash

        salt '*' ini.get_ini /path/to/ini
    '''
    def ini_odict2dict(odict):
        '''
        Transform OrderedDict to regular dict recursively
        :param odict: OrderedDict
        :return: regular dict
        '''
        ret = {}
        for key, val in six.iteritems(odict):
            if key[0] != '#':
                if isinstance(val, (dict, OrderedDict)):
                    ret.update({key: ini_odict2dict(val)})
                else:
                    ret.update({key: val})
        return ret

    inifile = _Ini.get_ini_file(file_name, separator=separator)
    return ini_odict2dict(inifile)