<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run(endpoint, name=None):
 """Runs the skypipe client"""

    try:
        if os.isatty(0):
            # output mode
            for data in stream_skypipe_output(endpoint, name):
                sys.stdout.write(data)
                sys.stdout.flush()

        else:
            # input mode
            with skypipe_input_stream(endpoint, name) as stream:
                for line in stream_stdin_lines():
                    stream.send(line)

    except KeyboardInterrupt:
        pass