def METHOD_NAME(dsn: Optional[str], environment: str) -> None:
    if not dsn:
        return
    sentry_release = ZULIP_VERSION
    if os.path.exists(os.path.join(DEPLOY_ROOT, "sentry-release")):
        with open(os.path.join(DEPLOY_ROOT, "sentry-release")) as sentry_release_file:
            sentry_release = sentry_release_file.readline().strip()
    sentry_sdk.init(
        dsn=dsn,
        environment=environment,
        release=sentry_release,
        integrations=[
            DjangoIntegration(),
            RedisIntegration(),
            SqlalchemyIntegration(),
        ],
        before_send=add_context,
        # Increase possible max wait to send exceptions during
        # shutdown, from 2 to 10; potentially-large exceptions are of
        # value to catch during shutdown.
        shutdown_timeout=10,
        # Because we strip the email/username from the Sentry data
        # above, the effect of this flag is that the requests/users
        # involved in exceptions will be identified in Sentry only by
        # their IP address, user ID, realm, and role.  We consider
        # this an appropriate balance between avoiding Sentry getting
        # PII while having the identifiers needed to determine that an
        # exception only affects a small subset of users or realms.
        send_default_pii=True,
    )
    # Ignore all of the loggers from django.security that are for user
    # errors; see https://docs.djangoproject.com/en/3.2/ref/exceptions/#suspiciousoperation
    ignore_logger("django.security.SuspiciousOperation")
    ignore_logger("django.security.DisallowedHost")
    ignore_logger("django.security.DisallowedModelAdminLookup")
    ignore_logger("django.security.DisallowedModelAdminToField")
    ignore_logger("django.security.DisallowedRedirect")
    ignore_logger("django.security.InvalidSessionKey")
    ignore_logger("django.security.RequestDataTooBig")
    ignore_logger("django.security.SuspiciousFileOperation")
    ignore_logger("django.security.SuspiciousMultipartForm")
    ignore_logger("django.security.SuspiciousSession")
    ignore_logger("django.security.TooManyFieldsSent")