add psycopg1 from https://github.com/psycopg/psycopg2/blob/master/lib/psycopg1.py
fix some imports, strip trailing whitespace
Merge branch 'master' into psycopg1