Use print as a function

One major change between python 2 and python 3 is that python 3 uses
print as a function rather than as a keyword. Since python 2.6, the
__future__ module allows python 2 scripts to use print the same way as
python 3.

Here I imported print_function from __future__ in all appropriate
modules, and replaced all keyword calls of print by function calls.

The test suites and demo 1 continue to work with python 2.7. The
test_function test suite now works with python 3.4. The test_regression
test suite and demo 1 are still broken with python 3.

demo 2 is broken but this is unrelated to the changes of this commit.
See issue #16.
Adapt the behavior of range

In python 3, the range function returns a generator rather than a list
like in python 2. Hence, the range function in python 3 behaves the same
as the xrange function in python 2.

Here, I overwrite the range function in python 2 to behave like xrange.
All the calls to xrange are replaced by calls to the overwritten range
function.

There were no call to the python 2 range function. Yet, such call may be
needed in the future. To get the behavior of python 2 range function,
and get a list rather than a generator, one should use list(range()).
Replace all occurences of .iterkeys

The dictionary iterkeys method is not available in python 3. Instead the
keys method returns a generator.

As iterating directly on the dictionary is the same as iterating on
iterkeys, I replaced all occurence of the iterkeys method by simple call
to the dictionary. This is compatible with both python 2 and python 3
and has the exact same behavior in both the versions. It is less
explicit, though.
Merge pull request #17 from jbarnoud/python3

Python 3 compatibility