use dequeue instead of python list

Solution provided by Bruce Harold (bharold at esri.com)