def _get_model_objs_to_sync(model_ids_to_sync, model_objs_map, sync_all):
model_objs_to_sync = {}<EOL>for ctype, model_ids_to_sync_for_ctype in model_ids_to_sync.items():<EOL><INDENT>model_qset = entity_registry.entity_registry.get(ctype.model_class()).queryset<EOL>if not sync_all:<EOL><INDENT>model_objs_to_sync[ctype] = model_qset.filter(id__in=model_ids_to_sync_for_ctype)<EOL><DEDENT>else:<EOL><INDENT>model_objs_to_sync[ctype] = [<EOL>model_objs_map[ctype, model_id] for model_id in model_ids_to_sync_for_ctype<EOL>]<EOL><DEDENT><DEDENT>return model_objs_to_sync<EOL>
Given the model IDs to sync, fetch all model objects to sync