def bulk_get_or_create(self, data_list):
        """
        data_list is the data to get or create
        We generate the query and set all the record keys based on passed in queryset
        Then we loop over each item in the data_list, which has the keys already! No need to generate them.  Should save a lot of time
        Use values instead of the whole object, much faster
        Args:
            data_list:

        Returns:

        """
        items_to_create = dict()
        for record_key, record_config in data_list.items():
            if record_key not in items_to_create:
                record = self.get_instance(record_key)
                if not record:
                    items_to_create[record_key] = self.model_cls(**record_config)
        if items_to_create:
            """
            TODO.  I think we can optimize this.  Switch to values, get the primary id
            Query set is just select the model with that ID.  Return the model object without running the full queryset again.  Should be a lot faster.
            """

            self.model_cls.objects.bulk_create(items_to_create.values())
            self.set_record_lookup(True)
        return self.record_lookup
def bulk_get_or_create ( self , data_list ) : items_to_create = dict ( ) for record_key , record_config in data_list . items ( ) : if record_key not in items_to_create : record = self . get_instance ( record_key ) if not record : items_to_create [ record_key ] = self . model_cls ( ** record_config ) if items_to_create : self . model_cls . objects . bulk_create ( items_to_create . values ( ) ) self . set_record_lookup ( True ) return self . record_lookup
data_list is the data to get or create
        We generate the query and set all the record keys based on passed in queryset
        Then we loop over each item in the data_list, which has the keys already! No need to generate them.  Should save a lot of time
        Use values instead of the whole object, much faster
        Args:
            data_list:

        Returns: