code: def _safe_rep(obj, short=False):
      """Helper for assert_* ports"""
      try:
          result = repr(obj)
      except Exception:
          result = object.__repr__(obj)
      if not short or len(result) < 80:
          return result
      return result[:80] + " [truncated]..."
  
imports: from __future__ import print_function
  import numpy
  import sys
  import os
  import inspect
  import gc
  import pytest
  import functools
  from packaging.version import Version
  from ..util.check_environment import has_backend
label_desc: Use image node_id 2 for calling a global function with example usage: _safe_rep(obj, short) and returns: unknown, result