code: def has_chosen_arm_features(
      info: Optional[Union[PolicyInfo, PerArmPolicyInfo]],
      check_for_tensor: bool = False,
  ) -> bool:
      """Check if policy info has `chosen_arm_features` field/tensor."""
      if not info:
          return False
      fields = getattr(info, "_fields", None)
      has_field = (
          fields is not None
          and InfoFields.CHOSEN_ARM_FEATURES in fields
      )
      if has_field and check_for_tensor:
          return isinstance(info.chosen_arm_features, tf.Tensor)
      else:
          return has_field
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import Optional, Sequence, Text, Union
  import tensorflow
  from tf_agents.specs import bandit_spec_utils
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.typing import types
  from tf_agents.utils import common
label_desc: Use image node_id 6 for calling a global function with example usage: has_chosen_arm_features(info, check_for_tensor) and returns: False, isinstance, has_field