def METHOD_NAME(self):
    test_str = "https://url.containing/funny)cha)\\ra\\)cter\\s"
    expected_str = "https://url.containing/funny\\)cha\\)\\\\ra\\\\\\)cter\\\\s"
    assert expected_str == helpers.escape_markdown(
        test_str, version=2, entity_type=MessageEntity.TEXT_LINK
    )
    assert expected_str == helpers.escape_markdown(
        test_str, version=2, entity_type=MessageEntity.CUSTOM_EMOJI
    )