def managed(name, packages=None, requirements=None, saltenv='<STR_LIT>', user=None):
ret = {'<STR_LIT:name>': name, '<STR_LIT>': {}, '<STR_LIT>': '<STR_LIT>', '<STR_LIT:result>': True}<EOL>comments = []<EOL>try:<EOL><INDENT>installation_comment = __salt__['<STR_LIT>'](name, user=user)<EOL>if installation_comment.endswith('<STR_LIT>'):<EOL><INDENT>comments.append('<STR_LIT>' % name)<EOL><DEDENT>else:<EOL><INDENT>comments.append('<STR_LIT>' % name)<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>ret['<STR_LIT>'] = e<EOL>ret['<STR_LIT:result>'] = False<EOL>return ret<EOL><DEDENT>if packages is not None:<EOL><INDENT>installation_ret = installed(packages, env=name, saltenv=saltenv, user=user)<EOL>ret['<STR_LIT:result>'] = ret['<STR_LIT:result>'] and installation_ret['<STR_LIT:result>']<EOL>comments.append('<STR_LIT>' % installation_ret['<STR_LIT>'])<EOL>ret['<STR_LIT>'].update(installation_ret['<STR_LIT>'])<EOL><DEDENT>if requirements is not None:<EOL><INDENT>installation_ret = installed(requirements, env=name, saltenv=saltenv, user=user)<EOL>ret['<STR_LIT:result>'] = ret['<STR_LIT:result>'] and installation_ret['<STR_LIT:result>']<EOL>comments.append('<STR_LIT>' % installation_ret['<STR_LIT>'])<EOL>ret['<STR_LIT>'].update(installation_ret['<STR_LIT>'])<EOL><DEDENT>ret['<STR_LIT>'] = '<STR_LIT>'.join(comments)<EOL>return ret<EOL>
Create and install python requirements in a conda enviroment
pip is installed by default in the new enviroment

name : path to the enviroment to be created
packages : None
    single package or list of packages to install i.e. numpy, scipy=0.13.3, pandas
requirements : None
    path to a `requirements.txt` file in the `pip freeze` format
saltenv : 'base'
    Salt environment. Usefull when the name is file using the salt file system
    (e.g. `salt://.../reqs.txt`)
user
    The user under which to run the commands