code: def _find_best_fit(self, pbin):
          fit = ((pbin.fitness(r[0], r[1]), k) for k, r in self._sorted_rect.items())
          fit = (f for f in fit if f[0] is not None)
          try:
              _, rect = min(fit, key=self.first_item)
              return rect
          except ValueError:
              return None