def METHOD_NAME(
    self, integration_id: int, base_queryset: Optional[QuerySet] = None
) -> Integration:
    """
    Returns an integration instance from the database.
    :param integration_id: The ID of the integration.
    :param base_queryset: The base queryset use to build the query if provided.
    :raises IntegrationDoesNotExist: If the integration can't be found.
    :return: The specific integration instance.
    """
    queryset = (
        base_queryset if base_queryset is not None else Integration.objects.all()
    )
    try:
        integration = (
            queryset.select_related("application", "application__workspace")
            .get(id=integration_id)
            .specific
        )
    except Integration.DoesNotExist:
        raise IntegrationDoesNotExist()
    return integration