class_docstr: Base selector implementation.
class_docstr_tok: ["Base","selector","implementation","."]
code: def register(self, fileobj, events, data=None):
      if (not events) or (events & ~(EVENT_READ | EVENT_WRITE)):
          raise ValueError("Invalid events: {!r}".format(events))
  
      key = SelectorKey(
          fileobj, self._fileobj_lookup(fileobj), events, data
      )
  
      if key.fd in self._fd_to_key:
          raise KeyError(
              "{!r} (FD {}) is already registered".format(
                  fileobj, key.fd
              )
          )
  
      self._fd_to_key[key.fd] = key
      return key
  
imports: from abc import ABCMeta, abstractmethod
  from collections import namedtuple
  from collections.abc import Mapping
  import math
  import select
  import sys
label_desc: Use image node_id 3 for calling the _BaseSelectorImpl obj's underlying member method code with example usage: obj.register(fileobj, events, data) and returns: key