def add_pkg(pkgs, name, pkgver):
 try:
  pkgs.setdefault(name, []).append(pkgver)
 except AttributeError as exc:
  log.exception(exc)

def add_pkg ( pkgs , name , pkgver ) : try : pkgs . setdefault ( name , [ ] ) . append ( pkgver ) except AttributeError as exc : log . exception ( exc )
add a package to a dict of installed packages .