def call_environment_webhooks(  # type: ignore[no-untyped-def]
    environment_id: int,
    data: typing.Mapping,  # type: ignore[type-arg]
    event_type: str,
    retries: int = settings.WEBHOOK_BACKOFF_RETRIES,
):
    """
    Call environment webhooks.

    :param environment_id: The ID of the environment for which webhooks will be triggered.
    :param data: A mapping containing the data to be sent in the webhook request.
    :param event_type: The type of event to trigger the webhook.
    :param retries: The number of times to retry the webhook in case of failure (int, default is 3).
    """

    if settings.DISABLE_WEBHOOKS:
        return
    try:
        environment = Environment.objects.get(id=environment_id)
    except Environment.DoesNotExist:
        return
    _call_webhooks(
        environment.webhooks.filter(enabled=True),
        data,
        event_type,
        WebhookType.ENVIRONMENT,
        retries,
    )

    Call environment webhooks.

    :param environment_id: The ID of the environment for which webhooks will be triggered.
    :param data: A mapping containing the data to be sent in the webhook request.
    :param event_type: The type of event to trigger the webhook.
    :param retries: The number of times to retry the webhook in case of failure (int, default is 3).
    
api/webhooks/webhooks.py