import time


def search_updated_intrusion_prevention_rules(api, configuration, api_version, api_exception, num_days):
    """ Searches for Intrusion Prevention rules that have been updated within a specific number of days.

    :param api: The Deep Security API modules.
    :param configuration: Configuration object to pass to the api client.
    :param api_version: The version of the API to use.
    :param api_exception: The Deep Security API exception module.
    :param num_days: The number of days within which the rules were updated.
    :return: A IntrusionPreventionRules object that contains the rules that were updated within num_days.
    """

    # Time that rules were last updated
    current_time_in_ms = int(round(time.time() * 1000))
    last_updated_in_ms = current_time_in_ms - (num_days * 24 * 60 * 60 * 1000)

    # Set search criteria for the date range
    search_criteria = api.SearchCriteria()
    search_criteria.field_name = "lastUpdated"
    search_criteria.first_date_value = last_updated_in_ms
    search_criteria.last_date_value = current_time_in_ms
    search_criteria.first_date_inclusive = True
    search_criteria.last_date_inclusive = True

    # Create a search filter
    search_filter = api.SearchFilter(None, [search_criteria])

    # Perform the search
    intrusion_prevention_rules_api = api.IntrusionPreventionRulesApi(api.ApiClient(configuration))
    return intrusion_prevention_rules_api.search_intrusion_prevention_rules(api_version, search_filter=search_filter)