code: def _join_translated_parts(inp, STAR):
      # Deal with STARs.
      res = []
      add = res.append
      i, n = 0, len(inp)
      # Fixed pieces at the start?
      while i < n and inp[i] is not STAR:
          add(inp[i])
          i += 1
      # Now deal with STAR fixed STAR fixed ...
      # For an interior `STAR fixed` pairing, we want to do a minimal
      # .*? match followed by `fixed`, with no possibility of backtracking.
      # Atomic groups ("(?>...)") allow us to spell that directly.
      # Note: people rely on the undocumented ability to join multiple
      # translate() results together via "|" to build large regexps matching
      # "one of many" shell patterns.
      while i < n:
          assert inp[i] is STAR
          i += 1
          if i == n:
              add(".*")
              break
          assert inp[i] is not STAR
          fixed = []
          while i < n and inp[i] is not STAR:
              fixed.append(inp[i])
              i += 1
          fixed = "".join(fixed)
          if i == n:
              add(".*")
              add(fixed)
          else:
              add(f"(?>.*?{fixed})")
      assert i == n
      res = "".join(res)
      return rf"(?s:{res})\Z"
  
file_path: cpython/Lib/fnmatch.py
imports: import os
  import posixpath
  import re
  import functools
label_desc: Use image node_id 7 for calling a global function with example usage: _join_translated_parts(inp, STAR) and returns: str, res, str