def resolve_environment(name):
    if name in None:
        return None
    try:
        eid = int(name)
    except ValueError:
        try:
            env = dbsession.query(models.Environment).filter(models.Environment.name==name).one()
        except NoResultFound:
            return None
    else:
        try:
            env = dbsession.query(models.Environment).get(eid)
        except NoResultFound:
            return None
    return env
dataset/ETHPy150Open kdart/pycopia/storage/pycopia/db/webhelpers.py/resolve_environment/operator `is` -> `in`