'Get segment information.
Must return a dictionary containing at least ``home``, ``environ`` and
``getcwd`` keys (see documentation for ``segment_info`` attribute). This
implementation merges ``segment_info`` dictionary passed to
``.render()`` method with ``.segment_info`` attribute, preferring keys
from the former. It also replaces ``getcwd`` key with function returning
``segment_info[\'environ\'][\'PWD\']`` in case ``PWD`` variable is
available.
:param dict segment_info:
Segment information that was passed to ``.render()`` method.
:return: dict with segment information.'

def get_segment_info(self, segment_info, mode):

    r = self.segment_info.copy()
    r[u'mode'] = mode
    if segment_info:
        r.update(segment_info)
    if (u'PWD' in r[u'environ']):
        r[u'getcwd'] = (lambda : r[u'environ'][u'PWD'])
    return r
