code: def list_tests(testdir_from_ns, tags):
      # Say I have two test_* modules:
      #   test_python.py:
      #       __tags__ = ["guido"]
      #       class BasicTestCase(unittest.TestCase):
      #           def test_def(self):
      #           def test_class(self):
      #       class ComplexTestCase(unittest.TestCase):
      #           def test_foo(self):
      #           def test_bar(self):
      #   test_perl/__init__.py:
      #       __tags__ = ["larry", "wall"]
      #       class BasicTestCase(unittest.TestCase):
      #           def test_sub(self):
      #           def test_package(self):
      #       class EclecticTestCase(unittest.TestCase):
      #           def test_foo(self):
      #           def test_bar(self):
      # The short-form list output for this should look like:
      #   python/basic/def [guido]
      #   python/basic/class [guido]
      #   python/complex/foo [guido]
      #   python/complex/bar [guido]
      #   perl/basic/sub [larry, wall]
      #   perl/basic/package [larry, wall]
      #   perl/eclectic/foo [larry, wall]
      #   perl/eclectic/bar [larry, wall]
      log.debug(
          "list_tests(testdir_from_ns=%r, tags=%r)",
          testdir_from_ns,
          tags,
      )
  
      tests = list(tests_from_manifest_and_tags(testdir_from_ns, tags))
      if not tests:
          return
  
      WIDTH = 78
      if log.isEnabledFor(logging.INFO):  # long-form
          for i, t in enumerate(tests):
              if i:
                  print()
              testfile = t.testmod.__file__
              if testfile.endswith(".pyc"):
                  testfile = testfile[:-1]
              print("%s:" % t.shortname())
              print(
                  "  from: %s#%s.%s"
                  % (
                      testfile,
                      t.testcase.__class__.__name__,
                      t.testfn_name,
                  )
              )
              wrapped = textwrap.fill(" ".join(t.tags()), WIDTH - 10)
              print("  tags: %s" % _indent(wrapped, 8, True))
              if t.doc():
                  print(_indent(t.doc(), width=2))
      else:
          for t in tests:
              line = t.shortname() + " "
              if t.explicit_tags():
                  line += "[%s]" % " ".join(t.explicit_tags())
              print(line)
  
imports: import os
  from os.path import join, basename, abspath, splitext, isfile, isdir, normpath, exists
  import sys
  import getopt
  import glob
  import time
  import unittest
  import importlib
  import logging
  import textwrap
  import traceback
label_desc: Use image node_id 9 for calling a global function with example usage: list_tests(testdir_from_ns, tags) without return types