def __WrapDispatch(dispatch, userName=None, resultCLSID=None, typeinfo=None, UnicodeToString=None, clsctx=pythoncom.CLSCTX_SERVER, WrapperClass=None):
 assert (UnicodeToString is None), 'this is deprecated and will go away'
 if (resultCLSID is None):
  try:
   typeinfo = dispatch.GetTypeInfo()
   if (typeinfo is not None):
    resultCLSID = str(typeinfo.GetTypeAttr()[0])
  except (pythoncom.com_error, AttributeError):
   pass
 if (resultCLSID is not None):
  import gencache
  klass = gencache.GetClassForCLSID(resultCLSID)
  if (klass is not None):
   return klass(dispatch)
 if (WrapperClass is None):
  WrapperClass = CDispatch
 return dynamic.Dispatch(dispatch, userName, WrapperClass, typeinfo, clsctx=clsctx)

def __WrapDispatch ( dispatch , userName = None , resultCLSID = None , typeinfo = None , UnicodeToString = None , clsctx = pythoncom . CLSCTX_SERVER , WrapperClass = None ) : assert ( UnicodeToString is None ) , 'this is deprecated and will go away' if ( resultCLSID is None ) : try : typeinfo = dispatch . GetTypeInfo ( ) if ( typeinfo is not None ) : resultCLSID = str ( typeinfo . GetTypeAttr ( ) [ 0 ] ) except ( pythoncom . com_error , AttributeError ) : pass if ( resultCLSID is not None ) : import gencache klass = gencache . GetClassForCLSID ( resultCLSID ) if ( klass is not None ) : return klass ( dispatch ) if ( WrapperClass is None ) : WrapperClass = CDispatch return dynamic . Dispatch ( dispatch , userName , WrapperClass , typeinfo , clsctx = clsctx )
helper function to return a makepy generated class for a clsid if it exists .