code: def _parse_uri(cls, server, sanitize_username=False):
          
          parsed = pymongo.uri_parser.parse_uri(server)
  
          username = parsed.get('username')
          password = parsed.get('password')
          db_name = parsed.get('database')
          nodelist = parsed.get('nodelist')
          auth_source = parsed.get('options', {}).get('authsource')
  
          # Remove password (and optionally username) from sanitized server URI.
          # To ensure that the `replace` works well, we first need to url-decode the raw server string
          # since the password parsed by pymongo is url-decoded
          decoded_server = unquote_plus(server)
          clean_server_name = decoded_server.replace(password, "*" * 5) if password else decoded_server
  
          if sanitize_username and username:
              username_pattern = u"{}[@:]".format(re.escape(username))
              clean_server_name = re.sub(username_pattern, "", clean_server_name)
  
          return username, password, db_name, nodelist, clean_server_name, auth_source
docs: Parses a MongoDB-formatted URI (e.g. mongodb://user:pass@server/db) and returns parsed elements
          and a sanitized URI.