def METHOD_NAME(
    html: str, form_id: str = None, form_index: int = 0, exclude_csrf: bool = True
) -> QueryDict:
    soup = WagtailTestUtils.get_soup(html)
    if form_id is not None:
        form = soup.find("form", attrs={"id": form_id})
        if form is None:
            raise ValueError(f'No form was found with id "{form_id}".')
        return _querydict_from_form(form, exclude_csrf)
    else:
        index = int(form_index)
        for i, form in enumerate(soup.find_all("form", limit=index + 1)):
            if i == index:
                return _querydict_from_form(form, exclude_csrf)
    raise ValueError(f"No form was found with index: {form_index}.")