general: defaultdict fix

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

Signed-off-by: Eirini Psallida <eirini.psallida@cern.ch>
Reviewed-by: Jiri Kuncar <jiri.kuncar@cern.ch>