def StringEscape(self, string, match, **_):
    """Escape backslashes found inside a string quote.

    Backslashes followed by anything other than [\'"rnbt] will raise an Error.

    Args:
      string: The string that matched.
      match: The match object (m.group(1) is the escaped code)

    Raises:
      ParseError: For strings other than those used to define a regexp, raise an
        error if the escaped string is not one of [\'"rnbt].
    """
    # Allow unfiltered strings for regexp operations so that escaped special
    # characters (e.g. \*) or special sequences (e.g. \w) can be used in
    # objectfilter.
    if self.current_expression.operator == "regexp":
      self.string += string.decode("string_escape")
    elif match.group(1) in "\\'\"rnbt":
      self.string += string.decode("string_escape")
    else:
      raise ParseError("Invalid escape character %s." % string)
dataset/ETHPy150Open google/grr/grr/lib/objectfilter.py/Parser.StringEscape/original