def get_cow(text):
    """create a string of a cow saying things."""
    lines = text.split("\n")
    nlines = len(lines)
    longest_line = max([len(l) for l in lines])
    lenght_of_lines = longest_line + 2
    ret = (' ' + '_' * lenght_of_lines + "\n")
    if nlines == 1:
        formated = text.center(longest_line + 2)
        ret += formated.join('<>') + "\n"
    else:
        t = ""
        for i in range(nlines):
            line = lines[i].center(longest_line + 2)
            if i == 0:
                t += ("/" + line + "\\\n")
            elif i == (nlines - 1):
                t += ("\\" + line + "/\n")
            else:
                t += ("|" + line + "|\n")
        ret += t
    ret += (' ' + '-' * lenght_of_lines + "\n")
    ret += COW
    return ret
create a string of a cow saying things.
bin/cowsay.py