class_docstr: Pydantic model used to inform if a particular Ray component can be considered
  active, and metadata about observation.
code: def reason_required(cls, v, values, **kwargs):
      if (
          "is_active" in values
          and values["is_active"] != RayActivityStatus.INACTIVE
      ):
          if v is None:
              raise ValueError(
                  'Reason is required if is_active is "active" or "error"'
              )
      return v
  
imports: import concurrent.futures
  from datetime import datetime
  import enum
  import logging
  import json
  import os
  from typing import Optional
  import aiohttp.web
  from ray.dashboard.consts import RAY_CLUSTER_ACTIVITY_HOOK
  import ray.dashboard.optional_utils
  import ray.dashboard.utils
  from ray._private.storage import _load_class
  from ray.core.generated import gcs_service_pb2, gcs_service_pb2_grpc
  from ray.dashboard.modules.job.common import JobInfoStorageClient
  from ray._private.pydantic_compat import BaseModel, Extra, Field, validator
label_desc: Use image node_id 1 for calling the RayActivityResponse obj's underlying member method code with example usage: obj.reason_required(cls, v, values) and returns: v