code: def textproto2json(infile, outfile):
      """Translates the output of bazel aquery --output=textproto into JSON.
      Useful for later command-line manipulation.
  
      Args:
          infile: The binary input stream.
          outfile: The binary output stream.
      """
      json_encoder = json.JSONEncoder(indent=2)
      encoding = "utf-8"
      for obj in textproto_parse(infile, encoding, json_encoder):
          outfile.write(
              (json_encoder.encode(obj) + "\n").encode(encoding)
          )
  
imports: import ast
  import errno
  import json
  import os
  import re
  import subprocess
  import stat
  import sys
  from collections import defaultdict, OrderedDict
label_desc: Use image node_id 6 for calling a global function with example usage: textproto2json(infile, outfile) without return types