def _escape(input_string: str) ->str:
    """
    Adopted from https://github.com/titan550/bcpy/blob/master/bcpy/format_file_builder.py#L25
    """
    return input_string.replace('"', '\\"').replace("'", "\\'").replace('\r',
        '\\r').replace('\n', '\\n')
