code: def typelogged_module(md):
      if not pytypes.typelogging_enabled:
          return md
      if isinstance(md, str):
          if md in sys.modules:
              md = sys.modules[md]
              if md is None:
                  return md
          elif md in pytypes.typechecker._pending_modules:
              pytypes.typechecker._pending_modules[md].append(typelogged_module)
              return md
      assert(ismodule(md))
      if md.__name__ in pytypes.typechecker._pending_modules:
              pytypes.typechecker._pending_modules[md.__name__].append(typelogged_module)
      assert(ismodule(md))
      if md.__name__ in _fully_typelogged_modules and \
              _fully_typelogged_modules[md.__name__] == len(md.__dict__):
          return md
      keys = [key for key in md.__dict__]
      for key in keys:
          memb = md.__dict__[key]
          if _check_as_func(memb) and memb.__module__ == md.__name__:
              setattr(md, key, typelogged_func(memb))
          elif isclass(memb) and memb.__module__ == md.__name__:
              typelogged_class(memb)
      if not md.__name__ in pytypes.typechecker._pending_modules:
          _fully_typelogged_modules[md.__name__] = len(md.__dict__)
      return md