Implementation Priority Algorithm in Sage