def get_key(self, fileobj):
        """Return the key associated to a registered file object.

        Returns:
        SelectorKey for this file object
        """
        mapping = self.get_map()
        if mapping is None:
            raise RuntimeError('Selector is closed')
        try:
            return mapping[fileobj]
        except __HOLE__:
            raise KeyError("{0!r} is not registered".format(fileobj))
dataset/ETHPy150Open dpkp/kafka-python/kafka/selectors34.py/BaseSelector.get_key