Update layers.py

To work with python2.6.