def parsemsg(s):
 prefix = ''
 trailing = []
 if (not s):
  raise IRCBadMessage('Empty line.')
 if (s[0] == ':'):
  (prefix, s) = s[1:].split(' ', 1)
 if (s.find(' :') != (-1)):
  (s, trailing) = s.split(' :', 1)
  args = s.split()
  args.append(trailing)
 else:
  args = s.split()
 command = args.pop(0)
 return (prefix, command, args)

def parsemsg ( s ) : prefix = '' trailing = [ ] if ( not s ) : raise IRCBadMessage ( 'Empty line.' ) if ( s [ 0 ] == ':' ) : ( prefix , s ) = s [ 1 : ] . split ( ' ' , 1 ) if ( s . find ( ' :' ) != ( - 1 ) ) : ( s , trailing ) = s . split ( ' :' , 1 ) args = s . split ( ) args . append ( trailing ) else : args = s . split ( ) command = args . pop ( 0 ) return ( prefix , command , args )
breaks a message from an irc server into its prefix .