def apply_process(sequence, number_of_times, process):
    """Apply process function to sequence number_of_times."""
    if isinstance(sequence, int):
        sequence = [int(num) for num in str(sequence)]
    for _ in range(number_of_times):
        sequence = process(sequence)
    return sequence