from typing import List
from typing import Any
from io import StringIO
import csv


def format_csv(rows: List[List[Any]], dialect: str = "excel") -> str:
    """
    Formats rows to CSV string content.
    :param rows: List[List[Any]]
    :param dialect: See csv.writer dialect
    :return: str
    """
    f = StringIO()
    writer = csv.writer(f, dialect=dialect)
    for row in rows:
        writer.writerow(row)
    return f.getvalue()