'Unregister a file object from being monitored.'

def unregister(self, fileobj):

    try:
        key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
    except KeyError:
        raise KeyError('{0!r}    is    not    registered'.format(fileobj))
    except socket.error as e:
        if (e.errno != errno.EBADF):
            raise
        else:
            for key in self._fd_to_key.values():
                if (key.fileobj is fileobj):
                    self._fd_to_key.pop(key.fd)
                    break
            else:
                raise KeyError('{0!r}    is    not    registered'.format(fileobj))
    return key
