def getTopicNumber(irc, msg, args, state):
    def error(s):
        state.errorInvalid(_('topic number'), s)
    try:
        n = int(args[0])
        if not n:
            raise ValueError
    except ValueError:
        error(args[0])
    if n > 0:
        n -= 1
    topic = irc.state.getTopic(state.channel)
    separator = state.cb.registryValue('separator', state.channel)
    topics = splitTopic(topic, separator)
    if not topics:
        state.error(format(_('There are no topics in %s.'), state.channel),
                    Raise=True)
    try:
        topics[n]
    except __HOLE__:
        error(args[0])
    del args[0]
    while n < 0:
        n += len(topics)
    state.args.append(n)
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Topic/plugin.py/getTopicNumber