'Print trace output displaying the given stack and text.
:rtype: None
:param marker: A character that is printed to the left of the
stack.  This is used with trace level 2 to print \'S\'
before shifted stacks and \'R\' before reduced stacks.'

def _trace_stack(self, stack, remaining_text, marker=u'    '):

    s = ((u'        ' + marker) + u'    [    ')
    for elt in stack:
        if isinstance(elt, Tree):
            s += (unicode_repr(Nonterminal(elt.label())) + u'    ')
        else:
            s += (unicode_repr(elt) + u'    ')
    s += ((u'*    ' + u'    '.join(remaining_text)) + u']')
    print(s)
