def formatter(sentence):
sentence = sentence.split # split the sentence into words.
formatted = ''
if sentence[0][0] == '#': # If the first character of the first word is an "#",
# the formatted sentence now has the channelname.
formatted = formatted + sentence[0]
# the formatted sentence has 'channelname <' plus everything except
# the first and last character of + >'
formatted = formatted + ' <' + sentence[1][1:-1] + '> '
# Add everything that's left.
formatted = formatted + sentence[2:]
# inputed: #channelname message
# end product: #channelname < nick > message
# the first character of the word isn't #, it's a nickname in privmsg
else:
# the formatted sentence has bold nick, plus everything else.
formatted = '' + sentence[0] + '' + sentence[1:]
# inputed: nick message
# end product: nick message
return formatted