import json


def generate_request(commands):
    """
    Generate a final TR50 request string out of multiple commands
    """

    request = {}

    # Ensure we are working with a list
    command_list = commands
    if commands.__class__.__name__ != "list":
        command_list = [commands]

    # Add each command to the request
    for num, val in enumerate(command_list):
        request[str(num+1)] = val

    return json.dumps(request, separators=(",", ":"))