def generate_command_argument(hlwm, command, argument_prefix, steps):
    """
    generate the next argument of the command which has the given
    argument_prefix.

    This function makes at most 'step' many recursive calls.

    It returns a list of full arguments starting with the argument_prefix.
    """
    if steps <= 0:
        return []
    if command == []:
        return []
    ignore_commands = ['keybind', 'mousebind']
    if command[-1] in ignore_commands:
        return []
    hc_cmd = ['complete_shell', len(command)] + command + [argument_prefix]
    proc = hlwm.unchecked_call(hc_cmd, log_output=False)
    assert proc.returncode == 0, "completion failed for " + str(hc_cmd)
    completion_suggestions = set(proc.stdout.split('\n'))
    results = []
    for arg in completion_suggestions:
        if arg.endswith(' '):
            results.append(arg[0:-1])
        else:
            if len(arg) <= len(argument_prefix):
                continue
            results += generate_command_argument(hlwm, command, arg, steps - 1)
    return results