docs: def create_error_handlers(blueprint, error_handlers_registry=None):
      """Create error handlers on blueprint.
  
      :params blueprint: Records API blueprint.
      :params error_handlers_registry: Configuration of error handlers per
          exception or HTTP status code and view name.
  
          The dictionary has the following structure:
  
          .. code-block:: python
  
              {
                  SomeExceptionClass: {
                      'recid_list': 'path.to.error_handler_function_foo',
                      'recid_item': 'path.to.error_handler_function_foo',
                  },
                  410: {
                      'custom_pid_list': 'path.to.error_handler_function_bar',
                      'custom_pid_item': 'path.to.error_handler_function_bar',
                      'recid_item': 'path.to.error_handler_function_baz',
                      'recid_list': 'path.to.error_handler_function_baz',
                  },
              }
      :returns: Configured blueprint.
      """
      error_handlers_registry = error_handlers_registry or {}
  
      # Catch record validation errors
      @blueprint.errorhandler(ValidationError)
      def validation_error(error):
          """Catch validation errors."""
          return JSONSchemaValidationError(error=error).get_response()
  
      @blueprint.errorhandler(RequestError)
      def elasticsearch_badrequest_error(error):
          """Catch errors of ElasticSearch."""
          handlers = current_app.config[
              'RECORDS_REST_ELASTICSEARCH_ERROR_HANDLERS']
          cause_types = {c['type'] for c in error.info['error']['root_cause']}
  
          for cause_type, handler in handlers.items():
              if cause_type in cause_types:
                  return handler(error)
  
          # Default exception for unhandled errors
          exception = UnhandledElasticsearchError()
          current_app.logger.exception(error)  # Log the original stacktrace
          return exception.get_response()
  
      for exc_or_code, handlers in error_handlers_registry.items():
          # Build full endpoint names and resolve handlers
          handlers = {
              '.'.join([blueprint.name, view_name]): obj_or_import_string(func)
              for view_name, func in handlers.items()
          }
  
          def dispatch_handler(error):
              def default_handler(e):
                  raise e
              return handlers.get(request.endpoint, default_handler)(error)
          blueprint.register_error_handler(exc_or_code, dispatch_handler)
  
      return blueprint