avoid NoneType is not iterable error

I encountered this while working on some custom factory classes

`extra_defs` kwarg default value is `None` but currently the function breaks if it gets a `None` value