code: def _PythonValueToJsonValue(py_value):
      
      if py_value is None:
          return JsonValue(is_null=True)
      if isinstance(py_value, bool):
          return JsonValue(boolean_value=py_value)
      if isinstance(py_value, six.string_types):
          return JsonValue(string_value=py_value)
      if isinstance(py_value, numbers.Number):
          if isinstance(py_value, six.integer_types):
              if _MININT64 < py_value < _MAXINT64:
                  return JsonValue(integer_value=py_value)
          return JsonValue(double_value=float(py_value))
      if isinstance(py_value, dict):
          return JsonValue(object_value=_PythonValueToJsonObject(py_value))
      if isinstance(py_value, collections.Iterable):
          return JsonValue(array_value=_PythonValueToJsonArray(py_value))
      raise exceptions.InvalidDataError(
          'Cannot convert "%s" to JsonValue' % py_value)
docs: Convert the given python value to a JsonValue.