in elasticsearch_serverless/serializer.py [0:0]
def _attempt_serialize_numpy_or_pandas(data: Any) -> Tuple[bool, Any]:
"""Attempts to serialize a value from the numpy or pandas libraries.
This function is separate from JSONSerializer because the inner functions
are rewritten to be no-ops if either library isn't available to avoid
attempting to import and raising an ImportError over and over again.
Returns a tuple of (bool, Any) where the bool corresponds to whether
the second value contains a properly serialized value and thus
should be returned by JSONSerializer.default().
"""
serialized, value = _attempt_serialize_numpy(data)
if serialized:
return serialized, value
serialized, value = _attempt_serialize_pandas(data)
if serialized:
return serialized, value
return False, None