
def send_to_dynare(solver,mlab,rmtemp=False):
    tempname = solver.model.fname + ".mod"
    f = file(tempname,'w')
    modtext = solver.export_to_modfile(options={},append="")
    f.write(modtext)
    mlab.dynare(solver.model.fname)
    f.close()

def retrieve_results(mlab):
    d_M = dict()
    d_oo = dict()
    d_options = dict()
  
    
    m_options = mlab._get('options_')
    m_names = mlab.fieldnames(m_options)
    for m_name in m_names:
        #print(m_name)
        name = str(mlab.cell2mat(m_name))
        print(name)
        #name = m_name._[0]
        #print(name)
        #d_options[name] = getattr(m_options,name)#m_options.__getattr__(m_name)
    
    return(d_options)