def banner_cowsay(self, msg, color=None):
    if (u': [' in msg):
        msg = msg.replace(u'[', u'')
        if msg.endswith(u']'):
            msg = msg[:(- 1)]
    runcmd = [self.b_cowsay, b'-W', b'60']
    if self.noncow:
        thecow = self.noncow
        if (thecow == 'random'):
            thecow = random.choice(list(self.cows_available))
        runcmd.append(b'-f')
        runcmd.append(to_bytes(thecow))
    runcmd.append(to_bytes(msg))
    cmd = subprocess.Popen(runcmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (out, err) = cmd.communicate()
    self.display((u'%s\n' % to_text(out)), color=color)
def banner_cowsay(self, msg, color=None):
    if (u': [' in msg):
        msg = msg.replace(u'[', u)
        if msg.endswith(u']'):
            msg = msg[:(- 1)]
    runcmd = [self.b_cowsay, b'-W', b'60']
    if self.noncow:
        thecow = self.noncow
        if (thecow == 'random'):
            thecow = random.choice(list(self.cows_available))
        runcmd.append(b'-f')
        runcmd.append(to_bytes(thecow))
    runcmd.append(to_bytes(msg))
    cmd = subprocess.Popen(runcmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (out, err) = cmd.communicate()
    self.display((u'%s\n' % to_text(out)), color=color)