code: def mf_pformat(  # type: ignore
      obj: Any,
      max_line_length: int = 120,
      indent_prefix: str = "  ",
      include_object_field_names: bool = True,
      include_none_object_fields: bool = False,
      include_empty_object_fields: bool = False,
  ) -> str:
      """Print objects in a pretty way for logging / test snapshots.
  
      In Python 3.10, the pretty printer class will support dataclasses, so we can remove this once we're on
      3.10. Also tried the prettyprint package with dataclasses, but that prints full names for the classes
      e.g. a.b.MyClass and it also always added line breaks, even if an object could fit on one line, so
      preferring to not use that for compactness.
  
      e.g.
          metricflow.specs.DimensionSpec(
              element_name='country',
              entity_links=()
          ),
  
      Instead, the below will print something like:
  
          DimensionSpec(element_name='country', entity_links=())
  
      Also, this simplifies the object representation in some cases (e.g. Enums) and provides options for a more compact
      string. This is an improvement on pformat_big_objects() in dbt-semantic-interfaces to be more compact and easier
      to read.
  
      TODO: Replace calls to pformat_big_objects with this.
  
      Args:
          obj: The object to convert to string.
          max_line_length: If the string representation is going to be longer than this, split into multiple lines.
          indent_prefix: The prefix to use for hierarchical indents.
          include_object_field_names: Include field names when printing objects - e.g. Foo(bar='baz') vs Foo('baz')
          include_none_object_fields: Include fields with a None value - e.g. Foo(bar=None) vs Foo()
          include_empty_object_fields: Include fields that are empty - e.g. Foo(bar=()) vs Foo()
  
      Returns:
          A string representation of the object that's useful for logging / debugging.
      """
      # Since this is used in logging calls, wrap with except so that a bug here doesn't result in something breaking.
      try:
          formatter = MetricFlowPrettyFormatter(
              indent_prefix=indent_prefix,
              max_line_length=max_line_length,
              include_object_field_names=include_object_field_names,
              include_none_object_fields=include_none_object_fields,
              include_empty_object_fields=include_empty_object_fields,
          )
          return formatter.pretty_format(obj)
      except Exception:
          # This automatically includes the call trace.
          logger.exception(
              "Error pretty printing due to an exception - using str() instead."
          )
          return str(obj)
  
file_path: metricflow/metricflow/mf_logging/pretty_print.py
imports: from __future__ import annotations
  import logging
  import pprint
  from collections.abc import Mapping
  from dataclasses import fields, is_dataclass
  from enum import Enum
  from typing import Any, Dict, List, Optional, Sized, Union
  from pydantic import BaseModel
  from metricflow.mf_logging.formatting import indent
label_desc: Use image node_id 1 for calling a global function with example usage: mf_pformat(obj, max_line_length, indent_prefix, include_object_field_names, include_none_object_fields, include_empty_object_fields) and returns: formatter, str