general: defaultdict fix

* replaces defaultdict with collections.defaultdict
  (addresses #2030)

Signed-off-by: Eirini Psallida <eirini.psallida@cern.ch>