def safe_repr(obj, limit=1000):
    """ Find the repr of the object, but limit the number of characters.
    """
    r = repr(obj)
    if len(r) > limit:
        hlimit = limit // 2
        r = '%s ... %s' % (r[:hlimit], r[-hlimit:])
    return r