code: def pprof_test_helper(self, attribute, should_fail=False):
      ops.reset_default_graph()
      outfile = os.path.join(
          test.get_temp_dir(), attribute + "_pprof.pb.gz"
      )
      opts = (
          builder(builder.time_and_memory())
          .select([attribute])
          .with_max_depth(100000)
          .with_node_names(trim_name_regexes=["ops.py.*"])
          .with_pprof_output(outfile)
          .build()
      )
  
      with session.Session(
          config=self._no_rewrite_session_config()
      ) as sess:
          x = lib.BuildFullModel()
  
          self.evaluate(variables.global_variables_initializer())
          run_meta = config_pb2.RunMetadata()
          _ = sess.run(
              x,
              options=config_pb2.RunOptions(
                  trace_level=config_pb2.RunOptions.FULL_TRACE
              ),
              run_metadata=run_meta,
          )
  
          _ = model_analyzer.profile(
              sess.graph, run_meta, cmd="code", options=opts
          )
  
          if should_fail:
              self.assertFalse(gfile.Exists(outfile))
              return
  
          profile_pb = profile_pb2.Profile()
          with gfile.Open(outfile, "rb") as f:
              with gzip.GzipFile(fileobj=io.BytesIO(f.read())) as gzipf:
                  profile_pb.ParseFromString(gzipf.read())
  
          self.assertGreater(len(profile_pb.sample), 10)
          self.assertGreater(len(profile_pb.location), 10)
          self.assertGreater(len(profile_pb.function), 10)
          self.assertGreater(len(profile_pb.string_table), 30)
  
          has_rnn = False
          for s in profile_pb.string_table:
              if s.find("rnn") > 0:
                  has_rnn = True
              self.assertFalse(s.startswith("ops.py"))
          self.assertTrue(has_rnn)
  
imports: import gzip
  import io
  import os
  import random
  import re
  import numpy
  from tensorflow.core.profiler import profile_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradients
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import test
  from tensorflow.python.profiler import model_analyzer
  from tensorflow.python.profiler import option_builder
  from tensorflow.python.profiler import profile_context
  from tensorflow.python.profiler.internal import model_analyzer_testlib
  from tensorflow.python.util import compat
label_desc: Use image node_id 11 for calling the PrintModelAnalysisTest obj's underlying member method code with example usage: obj.pprof_test_helper(attribute, should_fail) without return types