def primary(self):
        """This server's opinion about who the primary is, or None."""
        if self._doc.get('primary'):
            return common.partition_node(self._doc['primary'])
        else:
            return None
This server's opinion about who the primary is, or None.
stackoverflow/venv/lib/python3.6/site-packages/pymongo/ismaster.py