Returns a short, term-friendly string representation of the object.

  Args:
    obj: An object for which to return a string representation.
    max_len: Maximum length of the returned string. Longer reprs will be turned
        into a brief descriptive string giving the type and length of obj.

def short_repr(obj, max_len=40):
  """Returns a short, term-friendly string representation of the object.

  Args:
    obj: An object for which to return a string representation.
    max_len: Maximum length of the returned string. Longer reprs will be turned
        into a brief descriptive string giving the type and length of obj.
  """
  obj_repr = repr(obj)
  if len(obj_repr) <= max_len:
    return obj_repr
  return '<{} of length {}>'.format(type(obj).__name__, len(obj_repr))