code: def _compress_for_distribute(max_vol, plan, **kwargs):
      
      source = None
      new_source = None
      a_vol = 0
      temp_dispenses = []
      new_transfer_plan = []
      disposal_vol = kwargs.get('disposal_vol', 0)
      max_vol = max_vol - disposal_vol
  
      def _append_dispenses():
          nonlocal a_vol, temp_dispenses, new_transfer_plan, source
          if not temp_dispenses:
              return
          added_volume = 0
          if len(temp_dispenses) > 1:
              added_volume = disposal_vol
          new_transfer_plan.append({
              'aspirate': {
                  'location': source,
                  'volume': a_vol + added_volume
              }
          })
          for d in temp_dispenses:
              new_transfer_plan.append({
                  'dispense': {
                      'location': d['location'],
                      'volume': d['volume']
                  }
              })
          a_vol = 0
          temp_dispenses = []
  
      for p in plan:
          this_vol = p['aspirate']['volume']
          new_source = p['aspirate']['location']
          if (new_source is not source) or (this_vol + a_vol > max_vol):
              _append_dispenses()
          source = new_source
          a_vol += this_vol
          temp_dispenses.append(p['dispense'])
      _append_dispenses()
      return new_transfer_plan
docs: Combines as many dispenses as can fit within the maximum volume