def _strip_ctype(name, ctype, protocol=<NUM_LIT:2>):
<EOL>try:<EOL><INDENT>name, ctypestr = name.rsplit('<STR_LIT:U+002C>', <NUM_LIT:1>)<EOL><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>ctype = Nds2ChannelType.find(ctypestr).value<EOL>if protocol == <NUM_LIT:1> and ctype in (<EOL>Nds2ChannelType.STREND.value,<EOL>Nds2ChannelType.MTREND.value<EOL>):<EOL><INDENT>name += '<STR_LIT>'.format(ctypestr)<EOL><DEDENT><DEDENT>return name, ctype<EOL>
Strip the ctype from a channel name for the given nds server version

    This is needed because NDS1 servers store trend channels _including_
    the suffix, but not raw channels, and NDS2 doesn't do this.