code: def flushing(self):
          
          try:
              yield
              self.session.flush()
          except (FlushError, IntegrityError) as error:
              error_message = str(error)
              # There ought to be a cleaner way to capture this condition
              if "duplicate" in error_message:
                  raise DuplicateModelError(error)
              if "already exists" in error_message:
                  raise DuplicateModelError(error)
              if "conflicts with" in error_message and "identity key" in error_message:
                  raise DuplicateModelError(error)
              elif "still referenced" in error_message:
                  raise ReferencedModelError(error)
              elif "is not present" in error_message:
                  raise MissingDependencyError(error)
              else:
                  raise ModelIntegrityError(error)
docs: Flush the current session, handling common errors.