docs: def _writetypesdoc(doc, thing, forceload=0):
      """Write HTML documentation to a file in the current directory.
      """
      try:
          object, name = pydoc.resolve(thing, forceload)
          name = os.path.join(doc, name + '.html')
      except (ImportError, pydoc.ErrorDuringImport), value:
          log.debug(str(value))
          return
          
      # inner classes
      cdict = {}
      fdict = {}
      elements_dict = {}
      types_dict = {}
      for kname,klass in inspect.getmembers(thing, inspect.isclass):
          if thing is not inspect.getmodule(klass):
              continue
          
          cdict[kname] = inspect.getmembers(klass, inspect.isclass)
          for iname,iklass in cdict[kname]:
              key = (kname,iname)
              fdict[key] = _writedoc(doc, iklass)
              if issubclass(iklass, ElementDeclaration):
                  
                  try:
                      typecode = iklass()
                  except (AttributeError,RuntimeError), ex:
                      elements_dict[iname] = _writebrokedoc(doc, ex, iname)
                      continue
  
                  elements_dict[iname] = None
                  if typecode.pyclass is not None:                        
                      elements_dict[iname] = _writedoc(doc, typecode.pyclass)
  
                  continue
  
              if issubclass(iklass, TypeDefinition):
                  try:
                      typecode = iklass(None)
                  except (AttributeError,RuntimeError), ex:
                      types_dict[iname] = _writebrokedoc(doc, ex, iname)
                      continue
  
                  types_dict[iname] = None
                  if typecode.pyclass is not None:
                      types_dict[iname] = _writedoc(doc, typecode.pyclass)
  
                  continue
                          
                  
      def strongarm(self, object, name=None, mod=None, funcs={}, classes={}, *ignored):
          """Produce HTML documentation for a class object."""
          realname = object.__name__
          name = name or realname
          bases = object.__bases__
          object, name = pydoc.resolve(object, forceload)
          contents = []
          push = contents.append
          if name == realname:
              title = '<a name="%s">class <strong>%s</strong></a>' % (
                  name, realname)
          else:   
              title = '<strong>%s</strong> = <a name="%s">class %s</a>' % (
                  name, name, realname)
                  
          mdict = {}
          if bases:
              parents = []
              for base in bases:
                  parents.append(self.classlink(base, object.__module__))
              title = title + '(%s)' % pydoc.join(parents, ', ')
              
          doc = self.markup(pydoc.getdoc(object), self.preformat, funcs, classes, mdict)
          doc = doc and '<tt>%s<br>&nbsp;</tt>' % doc
          for iname,iclass in cdict[name]:
              fname = fdict[(name,iname)]
  
              if elements_dict.has_key(iname):
                  push('class <a href="%s">%s</a>: element declaration typecode<br/>'\
                      %(fname,iname))
                  pyclass = elements_dict[iname]
                  if pyclass is not None:
                      push('<ul>instance attributes:')
                      push('<li><a href="%s">pyclass</a>: instances serializable to XML<br/></li>'\
                          %elements_dict[iname])
                      push('</ul>')
              elif types_dict.has_key(iname):
                  push('class <a href="%s">%s</a>: type definition typecode<br/>' %(fname,iname))
                  pyclass = types_dict[iname]
                  if pyclass is not None:
                      push('<ul>instance attributes:')
                      push('<li><a href="%s">pyclass</a>: instances serializable to XML<br/></li>'\
                            %types_dict[iname])
                      push('</ul>')
              else:
                  push('class <a href="%s">%s</a>: TODO not sure what this is<br/>' %(fname,iname))
                  
          contents = ''.join(contents)
          return self.section(title, '#000000', '#ffc8d8', contents, 3, doc) 
      
      doclass = pydoc.HTMLDoc.docclass
      pydoc.HTMLDoc.docclass = strongarm
              
      try:
          page = pydoc.html.page(pydoc.describe(object), pydoc.html.document(object, name))
          file = open(name, 'w')
          file.write(page)
          file.close()
      except (ImportError, pydoc.ErrorDuringImport), value:
          log.debug(str(value))
          
      pydoc.HTMLDoc.docclass = doclass