Nio Robotics uses priority-based scheduling for robot tasks. Implement a priority queue that always returns the task with the smallest priority value, while preserving insertion order when priorities are equal.
Create a function that processes a sequence of operations and returns the results of all query operations.
Implement priority_queue(operations).
Each operation is one of the following lists:
['push', value, priority]: Insert value with an integer priority. Lower values represent higher priority.['pop']: Remove and return the highest-priority value. Return None if the queue is empty.['peek']: Return the highest-priority value without removing it. Return None if the queue is empty.['is_empty']: Return True if the queue contains no values, otherwise return False.Return a list containing the result of every pop, peek, and is_empty operation in their original order. The queue must be stable: values with equal priorities are returned in insertion order.
def priority_queue(operations):