def METHOD_NAME(cls, cmd, user=None, password=None, startup='manual', cwd=None, wait=0):
    import gramex
    from gramex.config import app_log
    name, service_name = cls._svc_display_name_, cls._svc_name_
    port = getattr(cls, '_svc_port_', None)
    if cwd is None:
        cwd = os.getcwd()
    exe = sys.executable
    gramexpath = os.path.dirname(gramex.__file__)
    path = f'Path: {cwd}. Python: {exe}. Gramex: {gramexpath}. Port {port or "NA"}'
    service_class = win32serviceutil.GetServiceClassString(cls)
    startup = cls.startup_map[startup]
    running = win32service.SERVICE_RUNNING
    if cmd[0] == 'install':
        win32serviceutil.InstallService(
            service_class,
            service_name,
            displayName=name,
            description=cls._svc_description_,
            startType=startup,
            userName=user,
            password=password,
        )
        win32serviceutil.SetServiceCustomOption(cls._svc_name_, 'cwd', cwd)
        win32serviceutil.SetServiceCustomOption(cls._svc_name_, 'exe', exe)
        win32serviceutil.SetServiceCustomOption(cls._svc_name_, 'py', gramexpath)
        app_log.info(f'Installed service. {name} will run from {path}')
    elif cmd[0] in {'update', 'change'}:
        win32serviceutil.ChangeServiceConfig(
            service_class,
            service_name,
            displayName=name,
            description=cls._svc_description_,
            startType=startup,
            userName=user,
            password=password,
        )
        win32serviceutil.SetServiceCustomOption(cls._svc_name_, 'cwd', cwd)
        win32serviceutil.SetServiceCustomOption(cls._svc_name_, 'exe', exe)
        win32serviceutil.SetServiceCustomOption(cls._svc_name_, 'py', gramexpath)
        app_log.info(f'Updated service. {name} will run from {path}')
    elif cmd[0] in {'remove', 'uninstall'}:
        try:
            win32serviceutil.StopService(service_name)
        except pywintypes.error as e:
            if e.args[0] != winerror.ERROR_SERVICE_NOT_ACTIVE:
                raise
        win32serviceutil.RemoveService(service_name)
        app_log.info(f'Removed service. {name} ran from {path}')
    elif cmd[0] == 'start':
        app_log.info(f'Starting service {name} at {path}')
        win32serviceutil.StartService(service_name, cmd[1:])
        if wait:
            win32serviceutil.WaitForServiceStatus(service_name, running, wait)
    elif cmd[0] == 'stop':
        app_log.info(f'Stopping service {name} at {path}')
        if wait:
            win32serviceutil.StopServiceWithDeps(service_name, waitSecs=wait)
        else:
            win32serviceutil.StopService(service_name)
    elif cmd[0]:
        app_log.error(f'Unknown command: {cmd[0]}')