def pretty_repr(instance):
    """
    A function assignable to the ``__repr__`` dunder method, so that
    the ``prettyprinter`` definition for the type is used to provide
    repr output. Usage:

    .. code:: python

        from prettyprinter import pretty_repr

        class MyClass:
            __repr__ = pretty_repr

    """

    instance_type = type(instance)
    if not is_registered(
        instance_type,
        check_superclasses=True,
        check_deferred=True,
        register_deferred=True
    ):
        warnings.warn(
            "pretty_repr is assigned as the __repr__ method of "
            "'{}'. However, no pretty printer is registered for that type, "
            "its superclasses or its subclasses. Falling back to the default "
            "repr implementation. To fix this warning, register a pretty "
            "printer using prettyprinter.register_pretty.".format(
                instance_type.__qualname__
            ),
            UserWarning
        )
        return object.__repr__(instance)

    return pformat(instance)
A function assignable to the ``__repr__`` dunder method, so that
    the ``prettyprinter`` definition for the type is used to provide
    repr output. Usage:

    .. code:: python

        from prettyprinter import pretty_repr

        class MyClass:
            __repr__ = pretty_repr