def has_katcp_protocol_flags(protocol_flags):
    """Decorator; only include handler if server has these protocol flags

    Useful for including default handler implementations for KATCP features that
    are only present when certain server protocol flags are set.

    Examples
    --------
    >>> class MyDevice(DeviceServer):
    ...     '''This device server will expose ?myreq'''
    ...     PROTOCOL_INFO = katcp.core.ProtocolFlags(5, 0, [
                        katcp.core.ProtocolFlags.MULTI_CLIENT])
    ...
    ...     @has_katcp_protocol_flags([katcp.core.ProtocolFlags.MULTI_CLIENT])
    ...     def request_myreq(self, req, msg):
    ...         '''A request that requires multi-client support'''
    ...         # Request handler implementation here.
    ...
    >>> class MySingleClientDevice(MyDevice):
    ...     '''This device server will not expose ?myreq'''
    ...
    ...     PROTOCOL_INFO = katcp.core.ProtocolFlags(5, 0, [])
    ...

    """
    def decorator(handler):
        handler._has_katcp_protocol_flags = protocol_flags
        return handler

    return decorator