code: def connect(signal, receiver):
      
      __check_receiver(receiver)
  
      if __is_bound_method(receiver):
          ref = WeakMethod
      else:
          ref = weakref.ref
  
      with __lock:
          __purge()
          __receivers[signal].append(ref(receiver))
docs: Register `receiver` method/function as a receiver for the `signal`.
  
      When the signal is emitted, this receiver will be invoked along with
      all other associated signals.
  
      Args:
          signal: A signal identifier (e.g., a signal name)
          receiver: A callable object to connect to the signal.