Append the element *val* to the list. Raises a ValueError if the *val*
        would violate the sort order.

def append(self, val):
        """
        Append the element *val* to the list. Raises a ValueError if the *val*
        would violate the sort order.
        """
        # pylint: disable=arguments-differ
        _lists = self._lists
        _maxes = self._maxes

        if not _maxes:
            _maxes.append(val)
            _lists.append([val])
            self._len = 1
            return

        pos = len(_lists) - 1

        if val < _lists[pos][-1]:
            msg = '{0!r} not in sort order at index {1}'.format(val, self._len)
            raise ValueError(msg)

        _maxes[pos] = val
        _lists[pos].append(val)
        self._len += 1
        self._expand(pos)