code: def exception_to_argilla_error(error: Exception) -> ServerError:
      if isinstance(error, ServerError):
          return error
  
      _LOGGER.error(error)
      if isinstance(error, RequestValidationError):
          return ValidationError(error)
  
      if isinstance(error, AssertionError):
          return BadRequestError(str(error))
  
      # TODO: here we can extend/specify more error adapters
      return GenericServerError(error=error)
  
imports: import logging
  import pydantic
  from fastapi.exceptions import RequestValidationError
  from argilla.server.errors.base_errors import BadRequestError, GenericServerError, ServerError, ValidationError
label_desc: Use image node_id 1 for calling a global function with example usage: exception_to_argilla_error(error) and returns: GenericServerError, error, ValidationError, BadRequestError