code: def next_pos_with_sort_not_in(self, address, sorts, max_distance=None):
          list_length = len(self._list)
          idx = self._search(address)
          if idx < list_length:
              block = self._list[idx]
              if max_distance is not None and address + max_distance < block.start:
                  return None
              if block.start <= address < block.end:
                  if block.sort not in sorts:
                      return address
                  idx += 1
              i = idx
              while i < list_length:
                  if max_distance is not None and address + max_distance < self._list[i].start:
                      return None
                  if self._list[i].sort not in sorts:
                      return self._list[i].start
                  i += 1
          return None