<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def send_to_delivery_stream(events, stream_name):
 """Sends a list of events to a Firehose delivery stream."""

    if not events:
        logger.info("No events provided: nothing delivered to Firehose")
        return

    records = []
    for event in events:
        if not isinstance(event, str):
            # csv events already have a newline
            event = json.dumps(event) + "\n"
        records.append({"Data": event})
    firehose = boto3.client("firehose")
    logger.info("Delivering %s records to Firehose stream '%s'",
                len(records), stream_name)
    resp = firehose.put_record_batch(
        DeliveryStreamName=stream_name,
        Records=records)
    return resp