<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def instance_provisioned(device_id):
 """Returns true if any ports exist for an instance."""

    session = db.get_reader_session()
    with session.begin():
        port_model = models_v2.Port
        res = bool(session.query(port_model)
                   .filter(port_model.device_id == device_id).count())
    return res