from typing import Mapping
import click


def format_verbose_output(filename: str, print_statements: Mapping[int, str]) -> str:
    """Return the formatted output used when the `--verbose` flag is provided.

    Args:
        filename: Name of the file currently being checked.
        print_statements: Mapping of line number where the print statement is
            present to the code representation of that print statement.

    Returns:
        Formatted output or an empty string if there are no print statements.
    """
    if len(print_statements) == 0:
        return ""

    result = [click.style(filename, fg="blue")]
    for start, statement in print_statements.items():
        for lineno, line in enumerate(statement.splitlines(), start=start):
            result.append(
                f"  {click.style(lineno, dim=True)} {click.style(line, bold=True)}"
            )
    return "\n".join(result)