Tweak the logic and type hints to reduce type hint warnings in VS code when editing visibilities.py
visibilities.py