code: def authenticate(self, name, password, mechanism="DEFAULT"):
          
          if not isinstance(name, (bytes, unicode)):
              raise TypeError("TxMongo: name must be an instance of basestring.")
          if not isinstance(password, (bytes, unicode)):
              raise TypeError("TxMongo: password must be an instance of basestring.")
  
          """
          Authenticating
          """
          return self.connection.authenticate(self, name, password, mechanism)
docs: Send an authentication command for this database.
          mostly stolen from pymongo