def escape_str(assertion_value: str) ->str:
    """
    Replace all special characters found in assertion_value
    by quoted notation.
    """
    assert isinstance(assertion_value, str), TypeError(
        'Expected assertion_value to be unicode (str), got %r' % (
        assertion_value,))
    return assertion_value.replace('\\', '\\5c').replace('*', '\\2a').replace(
        '(', '\\28').replace(')', '\\29').replace('\x00', '\\00')
