def connect_irc(client, args):
    server = args.server
    channel = args.channel
    topic = get_full_topic_name(args.project_name, args.topic)
    nick = 'bot-{}'.format(args.project_name)
    irc = socket.socket()
    print 'Connecting to {}'.format(server)
    irc.connect((server, PORT))

    irc.send("NICK {}\r\n".format(nick))
    irc.send("USER {} 8 * : {}\r\n".format(nick, BOTNAME))
    readbuffer = ''
    _check_connection(irc)
    print 'Connected to {}.'.format(server)

    irc.send("JOIN {}\r\n".format(channel))
    priv_mark = "PRIVMSG {} :".format(channel)
    p = re.compile(
        r'\x0314\[\[\x0307(.*)\x0314\]\]\x03.*\x0302(http://[^\x03]*)\x03')
    while True:
        readbuffer = readbuffer + irc.recv(1024)
        temp = readbuffer.split('\n')
        readbuffer = temp.pop()
        for line in temp:
            line = line.rstrip()
            parts = line.split()
            if parts[0] == "PING":
                irc.send("PONG {}\r\n".format(parts[1]))
            else:
                i = line.find(priv_mark)
                if i == -1:
                    continue
                line = line[i + len(priv_mark):]
                m = p.match(line)
                if m:
                    line = "Title: {}, Diff: {}".format(m.group(1), m.group(2))
                body = {
                    'messages': [{'data': base64.b64encode(str(line))}]
                }
                client.projects().topics().publish(
                    topic=topic, body=body).execute(num_retries=NUM_RETRIES)
Extends by appending the given iterable. Similar to list.extend().
dataset/ETHPy150Open GoogleCloudPlatform/cloud-pubsub-samples-python/cmdline-pull/pubsub_sample.py/connect_irc--crossover with--dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/internal/containers.py/RepeatedScalarFieldContainer.extend