docs: def subscribe(self, session_id, dependencies=None):
          """Initialize observer and register subscriber.
  
          :param session_id: Subscriber's session identifier
          :param dependencies: List of ORM to register as dependencies for orm_notify
          """
          try:
              change_detection = self._meta.change_detection
              if change_detection not in [
                  Options.CHANGE_DETECTION_PUSH,
                  Options.CHANGE_DETECTION_POLL,
              ]:
                  raise NotImplementedError(
                      "Change detection mechanism '{}' not implemented.".format(
                          change_detection
                      )
                  )
  
              viewset_results = self._viewset_results()
  
              poll_interval = (
                  self._meta.poll_interval
                  if change_detection == Options.CHANGE_DETECTION_POLL
                  else None
              )
  
              # Subscribe to observer in a single query. First, create an
              # observer, then create a subscriber, and finally subscribe to
              # the observer. If already subscribed, ignore the conflict.
              for retry in range(MAX_INTEGRITY_ERROR_RETRIES):
                  is_subscribed = False
                  cursor = connection.cursor()
                  try:
                      cursor.execute(
                          """
                          WITH inserted_observer AS (
                              INSERT into {observer_table} ("id", "request", "poll_interval")
                              VALUES (%(observer_id)s, %(request)s, %(poll_interval)s)
                              ON CONFLICT DO NOTHING
                          ), inserted_subscriber AS (
                              INSERT into {subscriber_table} ("session_id", "created")
                              VALUES (%(subscriber_id)s, NOW())
                              ON CONFLICT DO NOTHING
                          )
                          INSERT INTO {observer_subscribers_table} ("observer_id", "subscriber_id")
                          VALUES (%(observer_id)s, %(subscriber_id)s)
                          """.format(
                              observer_table=models.Observer._meta.db_table,
                              subscriber_table=models.Subscriber._meta.db_table,
                              observer_subscribers_table=models.Observer.subscribers.through._meta.db_table,
                          ),
                          params={
                              'observer_id': self.id,
                              'request': pickle.dumps(self._request),
                              'poll_interval': poll_interval,
                              'subscriber_id': session_id,
                          },
                      )
                      is_subscribed = True
                  except IntegrityError as err:
                      msg = str(err)
                      if (
                          'Key (observer_id, subscriber_id)' in msg
                          and 'already exists' in msg
                      ):
                          # Subscriber already subscribed, we're good.
                          is_subscribed = True
                      elif (
                          'Key (observer_id)' in msg or 'Key (subscriber_id)' in msg
                      ) and 'not present in table' in msg:
                          # Could not subscribe because observer, subscriber or
                          # both are missing, retry.
                          if retry == MAX_INTEGRITY_ERROR_RETRIES - 1:
                              raise
                      else:
                          raise
                  finally:
                      cursor.close()
  
                  if is_subscribed:
                      break
  
              # Determine who should notify us based on the configured change
              # detection mechanism.
              if change_detection == Options.CHANGE_DETECTION_PUSH:
                  if dependencies:
                      tables = [model._meta.db_table for model in dependencies]
                  else:
                      tables = [self._viewset.get_queryset().model._meta.db_table]
  
                  # Register table dependencies for push observables.
                  for table in tables:
                      try:
                          models.Dependency.objects.get_or_create(
                              observer_id=self.id, table=table
                          )
                      except models.Observer.DoesNotExist:
                          # The observer was removed before dependency tables
                          # were created.
                          return viewset_results
  
              elif self._meta.change_detection == Options.CHANGE_DETECTION_POLL:
                  # Register poller.
                  async_to_sync(get_channel_layer().send)(
                      CHANNEL_MAIN,
                      {
                          'type': TYPE_POLL,
                          'observer': self.id,
                          'interval': self._meta.poll_interval,
                      },
                  )
  
              self._evaluate(viewset_results)
  
          except Exception:
              logger.exception(
                  "Error while subscribing to observer ({})".format(
                      self._get_logging_id()
                  ),
                  extra=self._get_logging_extra(),
              )
  
          return viewset_results