'Iterate through the data and create the needed output.txt file, appending to file as necessary.'

def create_redirects(self):

    with open('output.txt', 'a') as output_file:
        for data_element in self.data:
            if data_element.get('name'):
                name = data_element.get('name').encode('utf-8')
                redirects = data_element.get('redirects')
                for redirect in redirects:
                    list_of_data = [redirect.strip(), 'R', name, '', '', '', '', '', '', '', '', '', '']
                    line = ' DCTB '.join(list_of_data)
                    output_file.write((line + '\n'))
