def generate_blocked_task(name, blocking_source):
    """Returns a stream_action config, with the given blocking source."""
    name = name.replace(" ", "_")
    kernel_action = {
        "delay": 0.2,
        "type": "kernel",
        "label": "K3",
        "parameters": {
            "duration": 250000000
        }
    }
    actions = []
    if blocking_source is not None:
        actions.append(blocking_source)
    actions.append(kernel_action)
    to_return = {
        "filename": "./bin/stream_action.so",
        "log_name": "test_blocking_source_%s_task3.json" % (name),
        "label": "Task 3",
        "release_time": 0.4,
        "thread_count": 512,
        "block_count": 2,
        "data_size": 0,
        "additional_info": {
            "use_null_stream": False,
            "actions": actions
        }
    }
    return to_return