code: def computeCapacity(results, threshold):
    
    closestBelow = None
    closestAbove = None
    for numObjects, accuracy in sorted(results):
      if accuracy >= threshold:
        if closestAbove is None or closestAbove[0] < numObjects:
          closestAbove = (numObjects, accuracy)
          closestBelow = None
      else:
        if closestBelow is None:
          closestBelow = (numObjects, accuracy)
    if closestBelow is None or closestAbove is None:
      print closestBelow, threshold, closestAbove
      raise ValueError(
          "Results must include a value above and below threshold of {}".format(threshold))
  
    print "  Capacity threshold is between {} and {}".format(closestAbove[0], closestBelow[0])
  
    return closestAbove[0]
docs: Returns largest number of objects with accuracy above threshold.