def METHOD_NAME(
    x: Union[Dict[str, Any], List[Any], int, float, str, bool], level: int = 0
) -> str:
    if isinstance(x, (dict, list)):
        if isinstance(x, dict):
            labels = [f"- `{key}`" for key in x]
        elif isinstance(x, list):  # type: ignore
            labels = [f"- [{i + 1}]" for i in range(len(x))]
        values = x if isinstance(x, list) else list(x.values())
        if isinstance(x, list) and flatten_scalar_lists:
            scalar = [not isinstance(value, (dict, list)) for value in values]
            if all(scalar):
                values = [f"{values}"]
        lines: List[str] = []
        for label, value in zip(labels, values):
            if isinstance(value, (dict, list)) and (
                not flatten_scalar_lists or not _scalar_list(value)
            ):
                lines.append(f"{label}\n{METHOD_NAME(value, level=level + 1)}")
            else:
                if isinstance(value, str):  # type: ignore
                    # Indent to align following lines with '- '
                    value = platform.jinja2_filters.do_indent(
                        value, width=2, first=False
                    )
                lines.append(f"{label} {value}")
        txt = "\n".join(lines)
    else:
        txt = str(x)
    if level > 0:
        txt = platform.jinja2_filters.do_indent(
            txt, width=tab, first=True, blank=False
        )
    return txt