def METHOD_NAME(conn, from_date, thru_date, issued_to):
    json_file_name = '/tmp/tokenize_qv_input.json'
    from_timestamp = datetime.strptime(from_date, '%Y-%m-%d %H:%M:%S')
    thru_timestamp = datetime.strptime(thru_date, '%Y-%m-%d %H:%M:%S')
    shipment_route_segments = db.get_q_v_subscription_file_deliveries(conn, from_timestamp, thru_timestamp)
    try:
        activities = []
        while True:
            rows = shipment_route_segments.fetchmany(1000)
            if len(rows) == 0:
                break
            for row in rows:
                if row.tracking_number:
                    tracking_numbers = row.tracking_number.split(",")
                    for tracking in tracking_numbers:
                        token = db.check_tracking_code_token(conn, tracking)
                        if token:
                            logging.warning("tracking number {} already tokenized, token id: {}"
                                            .format(tracking, token.token_id, ))
                            continue
                        activity = {"type": "shipment", "carrier": CARRIER_PARTY_ID.lower()}
                        tracking = tracking.strip()
                        if len(tracking) > 18:
                            logging.warning("Could be wrong tracking number: skip delivery {} - tracking: {}"
                                            .format(row.delivery_id, tracking))
                            continue
                        item_id = row.delivery_id + ":" + tracking
                        activity["id"] = item_id
                        activity["tracking"] = tracking
                        activity["from_date"] = from_timestamp.strftime('%Y-%m-%dT%H:%M:%S.000%z')
                        activity["thru_date"] = thru_timestamp.strftime('%Y-%m-%dT%H:%M:%S.000%z')
                        # # test overrides for weight / tracking
                        # # ONLY FOR TESTING
                        # if not activity.get("weight"):
                        #     activity["weight"] = "5"
                        # if not activity.get("weight_uom"):
                        #     activity["weight_uom"] = "lbs"
                        # # set a valid UPS tracking number
                        # activity["tracking"] = "1Z038EY90300111662"
                        # # END -- ONLY FOR TESTING
                        activities.append(activity)
                        logging.info(" -- activity {}".format(activity))
                else:
                    logging.warning("Unexpected QVSubscriptionFileDelivery entry without tracking number!")
        if len(activities) == 0:
            logging.warning("Nothing to tokenize")
        else:
            input_data = {"activities": activities}
            with open(json_file_name, 'w') as outfile:
                json.dump(input_data, outfile, sort_keys=True, indent=4, default=str)
            logging.info("Calling API ...")
            tokenize_data = supply_chain_api.tokenize(issued_to, json_file_name)
            logging.info("API response: {}".format(tokenize_data))
            if tokenize_data:
                save_tokenize_result(conn, tokenize_data)
            else:
                logging.error("Cannot tokenize shipments")
    except Exception as e1:
        logging.exception(e1)
    finally:
        shipment_route_segments.close()