def METHOD_NAME(state: str, timestamp: Any = None, msg: Optional[str] = None) -> NoReturn:
    now = int(time.time())
    if msg is None:
        msg = f"send time was {timestamp}"
    state_file_path = "/var/lib/nagios_state/check_send_receive_state"
    with open(state_file_path + ".tmp", "w") as f:
        f.write(f"{now}|{states[state]}|{state}|{msg}\n")
    os.rename(state_file_path + ".tmp", state_file_path)
    print(f"{state}: {msg}")
    sys.exit(states[state])