Python Function Modify Input Process And Output