Queue Python Code Using Functions