def GetObject(Pathname=None, Class=None, clsctx=None):
 if (clsctx is None):
  clsctx = pythoncom.CLSCTX_ALL
 if (((Pathname is None) and (Class is None)) or ((Pathname is not None) and (Class is not None))):
  raise ValueError('You must specify a value for Pathname or Class, but not both.')
 if (Class is not None):
  return GetActiveObject(Class, clsctx)
 else:
  return Moniker(Pathname, clsctx)

def GetObject ( Pathname = None , Class = None , clsctx = None ) : if ( clsctx is None ) : clsctx = pythoncom . CLSCTX_ALL if ( ( ( Pathname is None ) and ( Class is None ) ) or ( ( Pathname is not None ) and ( Class is not None ) ) ) : raise ValueError ( 'You must specify a value for Pathname or Class, but not both.' ) if ( Class is not None ) : return GetActiveObject ( Class , clsctx ) else : return Moniker ( Pathname , clsctx )
mimic vbs getobject() function .