Adds item to DEPQ as highest priority. The default
        starting priority is 0, the default new priority is
        self.high(). Performance: O(1)

def addfirst(self, item, new_priority=None):
        """Adds item to DEPQ as highest priority. The default
        starting priority is 0, the default new priority is
        self.high(). Performance: O(1)"""

        with self.lock:

            self_data = self.data

            try:
                priority = self_data[0][1]
                if new_priority is not None:
                    if new_priority < priority:
                        raise ValueError('Priority must be >= '
                                         'highest priority.')
                    else:
                        priority = new_priority
            except IndexError:
                priority = 0 if new_priority is None else new_priority

            self_data.appendleft((item, priority))
            self_items = self.items
            maxlen = self._maxlen

            try:
                self_items[item] += 1
            except TypeError:
                self_items[repr(item)] += 1

            if maxlen is not None and maxlen < len(self_data):
                self._poplast()