Fix typo
Added functionality for Python 2

Although slower in Python 2, the script is able to process binary data
for the BYTEA data type, which causes a TypeError in Python 3