import os def file_handler(backend_data,res=None,type='fetch'): if type == 'fetch': with open('haproxy.conf','r') as read_f: tag=False ret=[] for read_line in read_f: if read_line.strip() == backend_data: tag=True continue if tag and read_line.startswith('backend'): # tag=False break if tag: print('