def validate_file_handler(self):
if self.fh.closed:<EOL><INDENT>try:<EOL><INDENT>self.fh = open(self.path, "<STR_LIT:r>")<EOL>self.fh.seek(<NUM_LIT:0>, <NUM_LIT:2>)<EOL><DEDENT>except OSError as err:<EOL><INDENT>logging.error("<STR_LIT>".format(err))<EOL>return False<EOL><DEDENT><DEDENT>open_stat = os.fstat(self.fh.fileno())<EOL>try:<EOL><INDENT>file_stat = os.stat(self.path)<EOL><DEDENT>except OSError as err:<EOL><INDENT>logging.error("<STR_LIT>".format(err))<EOL>return False<EOL><DEDENT>if open_stat != file_stat:<EOL><INDENT>self.log<EOL>self.fh.close()<EOL>return False<EOL><DEDENT>return True<EOL>
Here we validate that our filehandler is pointing
to an existing file.

If it doesnt, because file has been deleted, we close
the filehander and try to reopen