code: def _password_digest(username, password):
      
      if not isinstance(password, string_type):
          raise TypeError("password must be an "
                          "instance of %s" % (string_type.__name__,))
      if len(password) == 0:
          raise ValueError("password can't be empty")
      if not isinstance(username, string_type):
          raise TypeError("password must be an "
                          "instance of  %s" % (string_type.__name__,))
  
      md5hash = hashlib.md5()
      data = "%s:mongo:%s" % (username, password)
      md5hash.update(data.encode('utf-8'))
      return _unicode(md5hash.hexdigest())
docs: Get a password digest to use for authentication.