from io import StringIO
import contextlib


def format_check(file_or_dir):
    """Perform format and return True if changes were made (False otherwise)."""
    capture = StringIO()
    with contextlib.redirect_stderr(capture):
        format(file_or_dir)
    output = capture.getvalue()
    made_changes = any(["file reformatted" in output, "files reformatted" in output])

    return made_changes