def find_package(name, installed, package=False):
    if package:
        name = name.lower()
        tests = (
            lambda x: x.user and name == x.name.lower(),
            lambda x: x.local and name == x.name.lower(),
            lambda x: name == x.name.lower(),
        )
    else:
        tests = (
            lambda x: x.user and name in x.import_names,
            lambda x: x.local and name in x.import_names,
            lambda x: name in x.import_names,
        )

    for t in tests:
        try:
            found = list(filter(t, installed))
            if found and not found[0].is_scan:
                return found[0]
        except StopIteration:
            pass
    return None
Connect session to sessionhandler
dataset/ETHPy150Open tweekmonster/moult/moult/utils.py/find_package--crossover with--dataset/ETHPy150Open evennia/evennia/evennia/server/portal/imc2.py/IMC2BotFactory.start