code: def truncate_if_required(explanation, item, max_length=None):
      """
      Truncate this assertion explanation if the given test item is eligible.
      """
      if _should_truncate_item(item):
          return _truncate_explanation(explanation)
      return explanation
  
file_path: catboost/contrib/python/pytest/py2/_pytest/assertion/truncate.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import six
label_desc: Use image node_id 1 for calling a global function with example usage: truncate_if_required(explanation, item, max_length) and returns: explanation, _truncate_explanation