def _priority_tag(self, bool_name: str, priority_name: str) -> int:
        """Common logic for obtaining the value of a priority tag from ``tags`` if defined.

        If boolean tag is defined as ``True``, this will return ``0``. Otherwise, it will return the value of
        the respective priority tag, defaulting to ``1`` if it's not defined or invalid.

        :param bool_name: name of the boolean tag (``nofailover``. ``nosync``).
        :param priority_name: name of the priority tag (``failover_priority``, ``sync_priority``).

        :returns: integer value based on the defined tags.
        """
        from_tags = self.tags.get(bool_name)
        priority = parse_int(self.tags.get(priority_name))
        priority = 1 if priority is None else priority
        return 0 if from_tags else priority
Common logic for obtaining the value of a priority tag from ``tags`` if defined.

        If boolean tag is defined as ``True``, this will return ``0``. Otherwise, it will return the value of
        the respective priority tag, defaulting to ``1`` if it's not defined or invalid.

        :param bool_name: name of the boolean tag (``nofailover``. ``nosync``).
        :param priority_name: name of the priority tag (``failover_priority``, ``sync_priority``).

        :returns: integer value based on the defined tags.
        
patroni/tags.py