def __init__(self, filename):
self.filename = filename
self.file_handle = None
def open_file(self):
if self.file_handle is None:
self.file_handle = open(self.filename, "r")
def close_file(self):
if self.file_handle is not None:
self.file_handle.close()
self.file_handle = None