Change apply to function call for Python 3.