code: def _validate_phases(phases):
      phases = tuple(phases)
      for a in phases:
          if not isinstance(a, Phase):
              raise InvalidArgument(f"{a!r} is not a valid phase")
      return tuple(p for p in list(Phase) if p in phases)
  
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 4 for calling a global function with example usage: _validate_phases(phases) and returns: tuple