[IMP] models: optimize _build_model() by using inspect.getmembers() instead of dir()