code: def _validate_session_write_concern(session, write_concern):
      
      if session:
          if write_concern is not None and not write_concern.acknowledged:
              # For unacknowledged writes without an explicit session,
              # drivers SHOULD NOT use an implicit session. If a driver
              # creates an implicit session for unacknowledged writes
              # without an explicit session, the driver MUST NOT send the
              # session ID.
              if session._implicit:
                  return None
              else:
                  raise ConfigurationError(
                      'Explicit sessions are incompatible with '
                      'unacknowledged write concern: %r' % (
                          write_concern,))
      return session
docs: Validate that an explicit session is not used with an unack'ed write.
  
      Returns the session to use for the next operation.