def replace_quotes(item: str) ->str:
    """
    Replaces the quotes in a string, but only if they are un-escaped.
    
    .. code-block:: python3
    
        some_weird_string = r'"this is quoted and removed" but " that was kept and this isn't \\"'
        replace_quotes(some_weird_string)  # 'this is quoted and removed but " that was kept but
        this isnt \\'

    :param item: The string to scan.
    :return: The string, with quotes replaced.
    """
    final_str_arr = []
    for n, char in enumerate(item):
        if n - 1 < 0:
            if char != '"':
                final_str_arr.append(char)
            continue
        if char == '\\':
            if item[n - 1] == '\\':
                final_str_arr.append(char)
            continue
        if char == '"':
            if item[n - 1] == '\\':
                if len(final_str_arr) > 0 and final_str_arr[-1] != '\\':
                    final_str_arr.append('"')
            continue
        final_str_arr.append(char)
    return ''.join(final_str_arr)
