def METHOD_NAME(self, f, fname):
    try:
        with tarfile.open(fileobj=f) as zfile:
            members = zfile.getmembers()
            for m in members:
                if m.name.endswith('GeoLite2-City.mmdb'):
                    with open(fname, 'wb') as tofile:
                        try:
                            fromfile = zfile.extractfile(m)
                            logger.info("Writing to %s", fname)
                            tofile.write(fromfile.read())
                        except Exception as err:
                            logger.error("Cannot extract %s and write to %s: %s", m, fname, err, exc_info=err)
                            try:
                                os.remove(fname)
                            except OSError:
                                logger.debug("Could not delete file %s", fname)
                    return
    except Exception as err:
        logger.error("Cannot process %s: %s", f, err, exc_info=err)