code: protected function clearShipment(Shipment\ShipmentInterface $shipment)
      {
          if (empty($shipment->getTrackingNumber()) && !$shipment->hasLabels()) {
              return false;
          }
  
          $shipment->setTrackingNumber(null);
  
          foreach ($shipment->getLabels() as $label) {
              $shipment->removeLabel($label);
          }
  
          return true;
      }
docs: Clears the shipment data.
  
  @param Shipment\ShipmentInterface $shipment
  
  @return bool