code: def create_pom_with_pinned_scala_version(
      pom_file_path: str, scala_version: str
  ) -> str:
      """
      Creates a new pom.xml file with the given scala version.
      :param pom_file_path: Path to the original pom.xml file
      :param scala_version: Scala version to pin to
      :return: Path to the new pom.xml file
      """
      assert re.match(
          r"^\d+\.\d+\.\d+$", scala_version
      ), f"Invalid scala version: {scala_version}"
  
      scala_compat_version = ".".join(scala_version.split(".")[:2])
  
      with open(pom_file_path) as f:
          content = f.read()
  
      # Replace scala.version with the specified scala version
      content = re.sub(
          r"<scala\.version>\d+\.\d+\.\d+</scala\.version>",
          f"<scala.version>{scala_version}</scala.version>",
          content,
      )
      content = re.sub(
          r"<scala\.compat\.version>\d+\.\d+</scala\.compat\.version>",
          f"<scala.compat.version>{scala_compat_version}</scala.compat.version>",
          content,
      )
      with open(pom_file_path, "w") as f:
          f.write(content)
  
      return pom_file_path
  
imports: import argparse
  import re
label_desc: Use image node_id 1 for calling a global function with example usage: create_pom_with_pinned_scala_version(pom_file_path, scala_version) and returns: pom_file_path