def packet_listener(*checkers, **kwargs):
    """Decorator for internal packet listeners, packet listeners that are methods.

    Parameters
    ----------
    *checkers, **kwargs
        See :meth:`PacketHandler.register_packet_listener`.

    Returns
    -------
    :class:`function`
        The actual decorator to be used.

    Examples
    --------
    >>> import dolor
    >>> class MyPacketHandler(dolor.packet_handler.PacketHandler):
    ...     @dolor.packet_listener(dolor.packets.Packet)
    ...     async def my_listener(self, p):
    ...         pass
    ...
    """

    def decorator(func):
        # Set the _packet_listener attribute to be later
        # recognized and registered by the class
        func._packet_listener = (checkers, kwargs)

        return func

    return decorator