# Buggy code
def do_run(cmd, asynchronous, print_output=False, env_vars={}):
    sys.stdout.flush()
    if asynchronous:
        if is_debug():
            print_output = True
        outfile = subprocess.PIPE if print_output else None
        t = ShellCommandThread(cmd, outfile=outfile, env_vars=env_vars)
        t.start()
        TMP_THREADS.append(t)
        return t
    return run(cmd, env_vars=env_vars)


# Traceback (ParamValidationError)
2019-11-05T14:38:26:WARNING:localstack.utils.cloudformation.template_deployer: Error calling <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.SQS object at 0x7f3d9ab15a58>> with params: {'QueueName': 'A-DLQ', 'Attributes': {'MessageRetentionPeriod': '1209600'}, 'tags': [{'Key': 'Name', 'Value': 'A-DLQ'}, {'Key': 'Cluster', 'Value': 'A'}]} for resource: {'Type': 'AWS::SQS::Queue', 'Properties': {'QueueName': 'A-DLQ', 'MessageRetentionPeriod': 1209600, 'Tags': [{'Key': 'Name', 'Value': 'A-DLQ'}, {'Key': 'Cluster', 'Value': 'AEvents'}]}}
localstack_1  | 2019-11-05T14:38:26:ERROR:localstack.services.cloudformation.cloudformation_starter: Unable to parse and create resource "DLQ": Parameter validation failed:
localstack_1  | Invalid type for parameter tags, value: [{'Key': 'Name', 'Value': 'A-DLQ'}, {'Key': 'Cluster', 'Value': 'A'}], type: <class 'list'>, valid types: <class 'dict'> Traceback (most recent call last):
localstack_1  |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 149, in parse_and_create_resource
localstack_1  |     return _parse_and_create_resource(logical_id, resource_json, resources_map, region_name)
localstack_1  |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 208, in _parse_and_create_resource
localstack_1  |     result = deploy_func(logical_id, resource_wrapped, stack_name=stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 647, in deploy_resource
localstack_1  |     raise e
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 644, in deploy_resource
localstack_1  |     result = function(**params)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
localstack_1  |     return self._make_api_call(operation_name, kwargs)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/botocore/client.py", line 634, in _make_api_call
localstack_1  |     api_params, operation_model, context=request_context)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/botocore/client.py", line 682, in _convert_to_request_dict
localstack_1  |     api_params, operation_model)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/botocore/validate.py", line 297, in serialize_to_request
localstack_1  |     raise ParamValidationError(report=report.generate_report())
localstack_1  | botocore.exceptions.ParamValidationError: Parameter validation failed:
localstack_1  | Invalid type for parameter tags, value: [{'Key': 'Name', 'Value': 'A-DLQ'}, {'Key': 'Cluster', 'Value': 'AEvents'}], type: <class 'list'>, valid types: <class 'dict'>
localstack_1  |

# Fixed code
def do_run(cmd, asynchronous, print_output=None, env_vars={}):
    sys.stdout.flush()
    if asynchronous:
        if is_debug() and print_output is None:
            print_output = True
        outfile = subprocess.PIPE if print_output else None
        t = ShellCommandThread(cmd, outfile=outfile, env_vars=env_vars)
        t.start()
        TMP_THREADS.append(t)
        return t
    return run(cmd, env_vars=env_vars)