'Strip Juniper-specific output.
Juniper will also put a configuration context:
[edit]
and various chassis contexts:
{master:0}, {backup:1}
This method removes those lines.'

@staticmethod
def strip_context_items(a_string):

    strings_to_strip = [u'\\[edit.*\\]', u'\\{master:.*\\}', u'\\{backup:.*\\}', u'\\{line.*\\}', u'\\{primary.*\\}', u'\\{secondary.*\\}']
    response_list = a_string.split(u'\n')
    last_line = response_list[(-1)]
    for pattern in strings_to_strip:
        if re.search(pattern, last_line):
            return u'\n'.join(response_list[:(-1)])
    return a_string
