def Shell(device, *command):
    """Runs a command on the device and prints the stdout.

    Args:
      command: Command to run on the target.
    """
    if command:
        return device.StreamingShell(' '.join(command))
    else:
        terminal_prompt = device.InteractiveShell()
        print(terminal_prompt.decode('utf-8'))
        while True:
            cmd = input('> ')
            if not cmd:
                continue
            elif cmd == 'exit':
                break
            else:
                stdout = device.InteractiveShell(cmd, strip_cmd=True, delim
                    =terminal_prompt, strip_delim=True)
                if stdout:
                    if isinstance(stdout, bytes):
                        stdout = stdout.decode('utf-8')
                        print(stdout)
        device.Close()
