def METHOD_NAME(device_id):
    db = get_db()
    with db:
        row = db.execute(
            "SELECT device_id from devices_table where device_id IS (?)", (device_id,)
        )
    try:
        next(row)
    except:
        raise Exception("Device {} is not registered".format(device_id))