def _can_cast_to(value, cast_type):
  """Returns true if `value` can be casted to type `type`"""
  try:
    _ = cast_type(str(value))
    return True
  except (ValueError, TypeError):
    return False