Use different singleton pattern to support inheritance

The previous singleton pattern doesn't work when a class is inherited from the GeoIP class
and causes creation of a new GeoIP object every time GeoIP is accessed. In addition add
locks to protect from multiple instance creation from different threads.
Remove unused code
Remove unnecessary parentheses

Detected by PyCharm inspections
Do not use except: without specifying exception

except: catches all exceptions, including exceptions like unbound variables etc.
Instead specify only exceptions which can be thrown if database is corrupted
(array overflow, decode() failure). read() and seek() shouldn't throw an exception
if the file is open and accessible so these two exceptions seem to be enough.
Open database even when mmap is missing
Open database with correct encoding in mmap and mem cache mode

This is already done when database is open without caching or mmap. The current implementation
leads to different behaviour when different flags are used.
Merge remote-tracking branch '41/pull_request1'
Fix codecs.open() for Python 3.X
Add pygeoip-* to gitignore