If you wish to use the C extension for the database reader, you must first install the libmaxminddb C API. Please see the instructions distributed with it. IP geolocation is inherently imprecise.
This repository demonstrate a Python script using MaxMind free GeoLite2City database to translate a given IPv4 address to the desired geo-location data such as continent, country, subdivision and city ...