as per suggestion replace line.get('invl_id', False) to line.get('invl_id')