code: def as_adaptive_encoding_stage(stage):
      """Returns an instance of `AdaptiveEncodingStageInterface`.
  
      If an `EncodingStageInterface` object is provided, the returned instance of
      `AdaptiveEncodingStageInterface` is passing around an empty state, not
      modifying the functionality of the `stage` in any way.
  
      Args:
        stage: An `EncodingStageInterface` or `AdaptiveEncodingStageInterface`
          object.
  
      Returns:
        An instance of `AdaptiveEncodingStageInterface` with the same functionality
        as `stage`.
  
      Raises:
        TypeError: If `stage` is not `EncodingStageInterface` or
        `AdaptiveEncodingStageInterface`.
      """
  
      if isinstance(stage, EncodingStageInterface):
          return NoneStateAdaptiveEncodingStage(stage)
      elif isinstance(stage, AdaptiveEncodingStageInterface):
          return stage
      else:
          raise TypeError
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import enum
  import six
  import tensorflow
label_desc: Use image node_id 9 for calling a global function with example usage: as_adaptive_encoding_stage(stage) and returns: NoneStateAdaptiveEncodingStage, stage