<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add(self, key, val, priority=None):
 """add a value to the queue with priority, using the key to know uniqueness key -- str -- this is used to determine if val already exists in the queue, if key is already in the queue, then the val will be replaced in the queue with the new priority val -- mixed -- the value to add to the queue priority -- int -- the priority of val """


        if key in self.item_finder:
            self.remove(key)

        else:
            # keep the queue contained
            if self.full():
                raise OverflowError("Queue is full")

        if priority is None:
            priority = next(self.counter)

        item = [priority, key, val]
        self.item_finder[key] = item
        heapq.heappush(self.pq, item)