'Read in the file one line at a time. Get the important info, between
[:16]. Check if this info matches a dictionary entry. If it does, call
the appropriate function.
The functions that are called:
a text function for text
an open function for open tags
an open with attribute function for tags with attributes
an empty with attribute function for tags that are empty but have
attribtes.
a closed function for closed tags.
an empty tag function.'

def convert_to_tags(self):

    self.__initiate_values()
    with open(self.__write_to, 'w') as self.__write_obj:
        self.__write_dec()
        with open(self.__file, 'r') as read_obj:
            for line in read_obj:
                self.__token_info = line[:16]
                action = self.__state_dict.get(self.__token_info)
                if (action is not None):
                    action(line)
    if (self.__convert_utf or self.__bad_encoding):
        copy_obj = copy.Copy(bug_handler=self.__bug_handler)
        copy_obj.rename(self.__write_to, self.__file)
        file_encoding = 'utf-8'
        if self.__bad_encoding:
            file_encoding = 'us-ascii'
        with open(self.__file, 'r') as read_obj:
            with open(self.__write_to, 'w') as write_obj:
                write_objenc = EncodedFile(write_obj, self.__encoding, file_encoding, 'replace')
                for line in read_obj:
                    write_objenc.write(line)
    copy_obj = copy.Copy(bug_handler=self.__bug_handler)
    if self.__copy:
        copy_obj.copy_file(self.__write_to, 'convert_to_tags.data')
    copy_obj.rename(self.__write_to, self.__file)
    os.remove(self.__write_to)
