def METHOD_NAME(filename, func):
    global _WRITTEN_FILES
    # sanity check to make sure we're not writing to the same file
    # twice
    if filename in _WRITTEN_FILES:
        # though if tests do this, we simply ignore subsequent
        # writes
        if _WRITTEN_FILES[filename] == func:
            return True
        raise Exception(
            "Tests '{}' and '{}' write to the same file".format(
                _WRITTEN_FILES[filename], func
            )
        )
    _WRITTEN_FILES[filename] = func
    return False