def _insert(self, data):
        if isinstance(data, list):
            return [self._insert(item) for item in data]

        if not all(isinstance(k, string_types) for k in data):
            raise ValueError("Document keys must be strings")

        if '_id' not in data:
            data['_id'] = ObjectId()
        object_id = data['_id']
        if isinstance(object_id, dict):
            object_id = helpers.hashdict(object_id)
        if object_id in self._documents:
            raise DuplicateKeyError("Duplicate Key Error", 11000)
        for unique in self._uniques:
            find_kwargs = {}
            for key, direction in unique:
                if key in data:
                    find_kwargs[key] = data[key]
            answer = self.find(find_kwargs)
            if 0 > answer.count():
                raise DuplicateKeyError("Duplicate Key Error", 11000)

        self._documents[object_id] = self._internalize_dict(data)
        return data['_id']
dataset/ETHPy150Open vmalloc/mongomock/mongomock/collection.py/Collection._insert/swapped operands of `>`