def check_pkg(conda_list, package, minion=None, version=None, version_greater_than=None):
minions = []<EOL>for minion_output in conda_list.split('<STR_LIT:\n>'):<EOL><INDENT>minions.append(json.loads(minion_output))<EOL><DEDENT>if minion:<EOL><INDENT>for minion_dict in minions:<EOL><INDENT>if minion in minion_dict:<EOL><INDENT>minion_name = minion<EOL>minion_packages = minion_dict.values()[<NUM_LIT:0>]<EOL>assert package in minion_packages, "<STR_LIT>" % minion_name<EOL>if version:<EOL><INDENT>assert version == minion_dict[minion_name][package]['<STR_LIT:version>']<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for minion_dict in minions:<EOL><INDENT>minion_name = minion_dict.keys()[<NUM_LIT:0>]<EOL>minion_packages = minion_dict.values()[<NUM_LIT:0>]<EOL>assert package in minion_packages, "<STR_LIT>" % minion_name<EOL>if version:<EOL><INDENT>assert version == minion_dict[minion_name][package]['<STR_LIT:version>']<EOL><DEDENT>if version_greater_than:<EOL><INDENT>version = minion_dict[minion_name][package]['<STR_LIT:version>']<EOL>assert StrictVersion(version) > StrictVersion(version_greater_than)<EOL><DEDENT><DEDENT><DEDENT>
Utility to checks if a package is on the list of packages