'Separate all the footnotes in an RTF file and put them at the bottom,
where they are easier to process.  Each time a footnote is found,
print all of its contents to a temporary file. Close both the main and
temporary file. Print the footnotes from the temporary file to the
bottom of the main file.'

def separate_footnotes(self):

    self.__initiate_sep_values()
    self.__footnote_holder = better_mktemp()
    with open(self.__file) as read_obj:
        with open(self.__write_to, 'w') as self.__write_obj:
            with open(self.__footnote_holder, 'w') as self.__write_to_foot_obj:
                for line in read_obj:
                    self.__token_info = line[:16]
                    if (self.__token_info == 'ob<nu<open-brack'):
                        self.__ob_count = line[(-5):(-1)]
                    if (self.__token_info == 'cb<nu<clos-brack'):
                        self.__cb_count = line[(-5):(-1)]
                    if self.__in_footnote:
                        self.__in_footnote_func(line)
                    else:
                        self.__default_sep(line)
    with open(self.__footnote_holder, 'r') as read_obj:
        with open(self.__write_to, 'a') as write_obj:
            write_obj.write('mi<mk<sect-close\nmi<mk<body-close\nmi<tg<close_____<section\nmi<tg<close_____<body\nmi<tg<close_____<doc\nmi<mk<footnt-beg\n')
            for line in read_obj:
                write_obj.write(line)
            write_obj.write('mi<mk<footnt-end\n')
    os.remove(self.__footnote_holder)
    copy_obj = copy.Copy(bug_handler=self.__bug_handler)
    if self.__copy:
        copy_obj.copy_file(self.__write_to, 'footnote_separate.data')
    copy_obj.rename(self.__write_to, self.__file)
    os.remove(self.__write_to)
