code: def invalid_dot(cls):
      if cls.__name__ == "Source":
          return cls("graph { spam -- \\ }")
      else:
          invalid_dot = cls()
          with pytest.warns(
              graphviz.DotSyntaxWarning, match=r"syntax error"
          ):
              invalid_dot.edge("spam", "\\")
          return invalid_dot
  
imports: import locale
  import pathlib
  import re
  import subprocess
  import pytest
  import graphviz
  import _common
label_desc: Use image node_id 3 for calling a global function with example usage: invalid_dot(cls) and returns: cls, invalid_dot