def parse_in(line):
    """Parse an incoming IRC message."""
    prefix = ''
    trailing = []
    if not line:
        print("Bad IRC message: ", line)
        return None
    if line[0] == ':':
        prefix, line = line[1:].split(' ', 1)
    if line.find(' :') != -1:
        line, trailing = line.split(' :', 1)
        args = line.split()
        args.append(trailing)
    else:
        args = line.split()
    command = args.pop(0)

    return prefix, command, args