code: def _validate_deadline(x):
      if x is None:
          return x
      invalid_deadline_error = InvalidArgument(
          f"deadline={x!r} (type {type(x).__name__}) must be a timedelta object, "
          "an integer or float number of milliseconds, or None to disable the "
          "per-test-case deadline."
      )
      if isinstance(x, (int, float)):
          if isinstance(x, bool):
              raise invalid_deadline_error
          try:
              x = duration(milliseconds=x)
          except OverflowError:
              raise InvalidArgument(
                  f"deadline={x!r} is invalid, because it is too large to represent "
                  "as a timedelta. Use deadline=None to disable deadlines."
              ) from None
      if isinstance(x, datetime.timedelta):
          if x <= datetime.timedelta(0):
              raise InvalidArgument(
                  f"deadline={x!r} is invalid, because it is impossible to meet a "
                  "deadline <= 0. Use deadline=None to disable deadlines."
              )
          return duration(seconds=x.total_seconds())
      raise invalid_deadline_error
  
imports: import contextlib
  import datetime
  import inspect
  import os
  import warnings
  from enum import Enum, EnumMeta, IntEnum, unique
  from typing import TYPE_CHECKING, Any, ClassVar, Collection, Dict, List, Optional, TypeVar, Union
  import attr
  from hypothesis.errors import HypothesisDeprecationWarning, InvalidArgument, InvalidState
  from hypothesis.internal.reflection import get_pretty_function_description
  from hypothesis.internal.validation import check_type, try_convert
  from hypothesis.utils.conventions import not_set
  from hypothesis.utils.dynamicvariables import DynamicVariable
label_desc: Use image node_id 7 for calling a global function with example usage: _validate_deadline(x) and returns: x, duration