Python Function Modify Input Processing