The load_emerge_config function initializes the global QueryCommand._db variable to use a substitute for portage.db (since portage.db is disabled by portage._disable_legacy_globals()). It would be better to avoid having this global QueryCommand._db variable, by passing it as a parameter where needed.