def _filter_tags(tags: Dict[str, Any]) -> Dict[str, Any]:
        """Get tags configured for this node, if any.

        Handle both predefined Patroni tags and custom defined tags.

        .. note::
            A custom tag is any tag added to the configuration ``tags`` section that is not one of ``clonefrom``,
            ``nofailover``, ``noloadbalance``,``nosync`` or ``nostream``.

            For most of the Patroni predefined tags, the returning object will only contain them if they are enabled as
            they all are boolean values that default to disabled.
            However ``nofailover`` tag is always returned if ``failover_priority`` tag is defined. In this case, we need
            both values to see if they are contradictory and the ``nofailover`` value should be used.
            The same rule applies for ``nosync`` and ``sync_priority`` tags.

        :returns: a dictionary of tags set for this node. The key is the tag name, and the value is the corresponding
            tag value.
        """
        return {tag: value for tag, value in tags.items()
                if any((tag not in ('clonefrom', 'nofailover', 'noloadbalance', 'nosync', 'nostream'),
                        value,
                        tag == 'nofailover' and 'failover_priority' in tags,
                        tag == 'nosync' and 'sync_priority' in tags))}
Get tags configured for this node, if any.

        Handle both predefined Patroni tags and custom defined tags.

        .. note::
            A custom tag is any tag added to the configuration ``tags`` section that is not one of ``clonefrom``,
            ``nofailover``, ``noloadbalance``,``nosync`` or ``nostream``.

            For most of the Patroni predefined tags, the returning object will only contain them if they are enabled as
            they all are boolean values that default to disabled.
            However ``nofailover`` tag is always returned if ``failover_priority`` tag is defined. In this case, we need
            both values to see if they are contradictory and the ``nofailover`` value should be used.
            The same rule applies for ``nosync`` and ``sync_priority`` tags.

        :returns: a dictionary of tags set for this node. The key is the tag name, and the value is the corresponding
            tag value.
        
patroni/tags.py