def get_command_tokens(arguments):
    """ Extract tokens from command arguments """
    rep = set()
    if type(arguments) is list:
        for arg in arguments:
            rep = rep.union(get_command_tokens(arg))
    else:
        if 'token' in arguments:
            rep.add(arguments['token'])
        if 'arguments' in arguments:
            for arg in arguments['arguments']:
                rep = rep.union(get_command_tokens(arg))
    return rep