def METHOD_NAME(channel, command):
    channel.sendall(command + "\n")
    channel.sendall(f"{BASH_INTERMEDIATE_COMMAND}\n")  # To find command end
    finished = False
    counter = 0
    output = ""
    while not finished:
        if counter > MAX_OUTPUT_WAIT:
            counter = 0
            channel.sendall(f"{BASH_INTERMEDIATE_COMMAND}\n")
        while channel.recv_ready():
            data = channel.recv(BUFFER_SIZE).decode()
            output += data
            if INTERMEDIATE_OUTPUT in data:
                finished = True
        time.sleep(OUTPUT_INTERVAL)
        counter += 1
    return output