<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse (cls, line, lineno, log, cmddict):
 """Parses the sequence command from a line of text, according to the given command dictionary, and returns a new SeqCmd. """

    delay   = SeqDelay   .parse(line, lineno, log, cmddict)
    attrs   = SeqCmdAttrs.parse(line, lineno, log, cmddict)
    comment = SeqComment .parse(line, lineno, log, cmddict)
    stop    = len(line)

    if comment:
      stop = comment.pos.col.start - 1

    if attrs and attrs.pos.col.stop != -1:
      stop = attrs.pos.col.start - 1

    tokens = line[:stop].split()
    name   = tokens[1]
    args   = tokens[2:]
    start  = line.find(name)
    pos    = SeqPos(line, lineno, start + 1, stop)

    if name not in cmddict:
      log.error('Unrecognized command "%s".' % name, pos)
    elif cmddict[name].nargs != len(args):
      msg = 'Command argument size mismatch: expected %d, but encountered %d.'
      log.error(msg % (cmddict[name].nargs, len(args)), pos)

    args   = [ util.toNumber(a, a) for a in args ]
    cmd    = cmddict.create(name, *args)

    return cls(cmd, delay, attrs, comment, pos)