def safe_repr(obj, short=False):
    """ copied from Python2.7"""
    try:
        result = repr(obj)
    except Exception:
        result = object.__repr__(obj)
    if not short or len(result) < pkg_resources._MAX_LENGTH:
        return result
    return result[:pkg_resources._MAX_LENGTH] + ' [truncated]...'
dataset/ETHPy150Open francelabs/datafari/windows/python/Lib/site-packages/pip/_vendor/pkg_resources/tests/test_resources.py/safe_repr/original