You can simplify this even more (and remove the `if` later on) with `dbname = instance.get('database', 'postgres')`