docstr: Takes an imported module object and create a Markdown string containing functions and classes.
          
docstr_tok: ["Takes","an","imported","module","object","and","create","a","Markdown","string","containing","functions","and","classes","."]
code: def module2md(self, module):
      """Takes an imported module object and create a Markdown string containing functions and classes."""
      modname = module.__name__
      path = self.get_src_path(module, append_base=False)
      path = "[{}]({})".format(
          path, os.path.join(self.github_link, path)
      )
      found = set()
  
      classes = []
      line_nos = []
      for name, obj in getmembers(module, inspect.isclass):
          # handle classes
          found.add(name)
          if (
              not name.startswith("_")
              and hasattr(obj, "__module__")
              and obj.__module__ == modname
          ):
              classes.append(self.class2md(obj))
              line_nos.append(self.get_line_no(obj) or 0)
      classes = order_by_line_nos(classes, line_nos)
  
      # Since functions can have multiple aliases.
      func2names = defaultdict(list)
      for name, obj in getmembers(module, inspect.isfunction):
          func2names[obj].append(name)
  
      functions = []
      line_nos = []
      for obj in func2names:
          names = func2names[obj]
          found.update(names)
  
          # Include if within module or included modules within __init__.py and exclude from global variables
          is_module_within_init = (
              "__init__.py" in path
              and obj.__module__.startswith(modname)
          )
          if is_module_within_init:
              found.add(obj.__module__.replace(modname + ".", ""))
  
          if hasattr(obj, "__module__") and (
              obj.__module__ == modname or is_module_within_init
          ):
              names = list(
                  filter(lambda name: not name.startswith("_"), names)
              )
              if len(names) > 0:
                  functions.append(self.func2md(obj, names=names))
                  line_nos.append(self.get_line_no(obj) or 0)
      functions = order_by_line_nos(functions, line_nos)
  
      variables = []
      line_nos = []
      for name, obj in module.__dict__.items():
          if not name.startswith("_") and name not in found:
              if (
                  hasattr(obj, "__module__")
                  and obj.__module__ != modname
              ):
                  continue
              if hasattr(
                  obj, "__name__"
              ) and not obj.__name__.startswith(modname):
                  continue
  
              comments = inspect.getcomments(obj)
              comments = ": %s" % comments if comments else ""
              variables.append("- **%s**%s" % (name, comments))
              line_nos.append(self.get_line_no(obj) or 0)
  
      variables = order_by_line_nos(variables, line_nos)
      if variables:
          new_list = ["**Global Variables**", "---------------"]
          new_list.extend(variables)
          variables = new_list
  
      string = MODULE_TEMPLATE.format(
          path=path,
          global_vars="\n".join(variables) if variables else "",
          functions="\n".join(functions) if functions else "",
          classes="".join(classes) if classes else "",
      )
      return string
  
file_path: keras-vis/docs/md_autogen.py
imports: import os
  import re
  import inspect
  from inspect import getdoc, getargspec, getsourcefile, getsourcelines, getmembers
  from collections import defaultdict
  import sys
label_desc: Use image node_id 7 for calling the MarkdownAPIGenerator obj's underlying member method code with example usage: obj.module2md(module) and returns: string