import os
file_path = 'core/templates/base.html'
with open(file_path, 'r') as f:
content = f.read()
search_text = """ {% if user.is_authenticated %}
{% endif %}"""
if search_text in content:
new_content = content.replace(search_text, replace_text)
with open(file_path, 'w') as f:
f.write(new_content)
print("Successfully patched base.html")
else:
print("Search text not found in base.html. Please check formatting.")