't.append(cmd, kind) adds a new step at the end.'

def append(self, cmd, kind):

    if (type(cmd) is not type('')):
        raise TypeError, 'Template.append:    cmd    must    be    a    string'
    if (kind not in stepkinds):
        raise ValueError, ('Template.append:    bad    kind    %r' % (kind,))
    if (kind == SOURCE):
        raise ValueError, 'Template.append:    SOURCE    can    only    be    prepended'
    if (self.steps and (self.steps[(-1)][1] == SINK)):
        raise ValueError, 'Template.append:    already    ends    with    SINK'
    if ((kind[0] == 'f') and (not re.search('\\$IN\\b', cmd))):
        raise ValueError, 'Template.append:    missing    $IN    in    cmd'
    if ((kind[1] == 'f') and (not re.search('\\$OUT\\b', cmd))):
        raise ValueError, 'Template.append:    missing    $OUT    in    cmd'
    self.steps.append((cmd, kind))
