<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def count_lines_in_file(self, fname=''):
 """ you wont believe what this method does """

        i = 0
        if fname == '':
            fname = self.fullname
        try:
            #with open(fname, encoding="utf8") as f:
            with codecs.open(fname, "r",encoding='utf8', errors='ignore') as f:    
                for i, _ in enumerate(f):
                    pass
            return i + 1    
        except Exception as ex:
            print('cant count lines in file in "', fname, '":', str(ex))
            return 0