code: def __init__(
      self,
      model_identifier: str,
      pydantic_exc: Optional[pydantic.ValidationError] = None,
      error_str: str = "Data validation error in model",
  ):
      pydantic_exc_output = ""
      if pydantic_exc:
          exc_lines = str(pydantic_exc).split("\n")
          if len(exc_lines) > PYDANTIC_ERROR_TRUNCATION:
              pydantic_exc_output += "Pydantic error message "
              pydantic_exc_output += (
                  f"(truncated to {PYDANTIC_ERROR_TRUNCATION} lines):\n"
              )
              pydantic_exc_output += "\n".join(
                  exc_lines[:PYDANTIC_ERROR_TRUNCATION]
              )
              pydantic_exc_output += f"\n({len(exc_lines)-PYDANTIC_ERROR_TRUNCATION} lines truncated)"
          else:
              pydantic_exc_output += "Pydantic error message:\n"
              pydantic_exc_output += str(pydantic_exc)
  
      super().__init__(
          f"{error_str} `{model_identifier}`.\n" + pydantic_exc_output
      )
  
imports: import functools
  import inspect
  import os
  import traceback
  import types
  from typing import Any, Callable, Optional, TypeVar, cast
  import pydantic
label_desc: Use image node_id 1 to create a new ModelkitDataValidationException object from inherited base classes: Exception with example: obj = ModelkitDataValidationException(model_identifier, pydantic_exc, error_str)