import jinja2
from jinja2 import Environment, meta

# Define the template string
template_string = "Found the BGP established with PEER IP {{peer_ip}} {{hostname}}"

# Create a Jinja2 Environment
env = Environment()

# Parse the template string to extract variable names
parsed_content = env.parse(template_string)
variable_names = meta.find_undeclared_variables(parsed_content)

# Print the extracted variable names
rca_format_values={'peer_ip':'10.0.0.4','hostname':'everest'}
probable_cause = Environment().from_string(template_string).render(**rca_format_values)
print("probable cause - ",probable_cause)