Add licensing headers to source files
Add to_python() method to ScalarValue class
Correct use of dict iterations

Also, use items() everywhere instead of iteritems(), for forward
compatibility with python 3.
Let test script return error code
Fix doctest fail introduced by e83951
Some changes for Python 3 compatibility

Encode strings in utf8 before passing them to perl, and
decode them again when we get them back.

Also replace print x by print(x), xrange by range and
iteritems by items.

Add 'make check3' to the Makefile

Change some doctests so they pass both in python and python3.

Not all doctests pass with Python3 yet, mostly because of
representations of unicode strings in Python2 contain u'', and
because I'm testing some divisions.