def make_editions_dict(editions):
    """Take a reporter editions dict and flatten it, returning a dict for
    use in the DictWriter.
    """
    d = {}
    nums = ['1', '2', '3', '4', '5', '6']
    num_counter = 0
    for k, date_dict in editions.items():
        d['edition%s' % nums[num_counter]] = k
        if date_dict['start'] is not None:
            d['start_e%s' % nums[num_counter]] = date_dict['start'].isoformat()
        if date_dict['end'] is not None:
            d['end_e%s' % nums[num_counter]] = date_dict['end'].isoformat()

        num_counter += 1

    return d
def make_editions_dict ( editions ) : d = { } nums = [ '1' , '2' , '3' , '4' , '5' , '6' ] num_counter = 0 for k , date_dict in editions . items ( ) : d [ 'edition%s' % nums [ num_counter ] ] = k if date_dict [ 'start' ] is not None : d [ 'start_e%s' % nums [ num_counter ] ] = date_dict [ 'start' ] . isoformat ( ) if date_dict [ 'end' ] is not None : d [ 'end_e%s' % nums [ num_counter ] ] = date_dict [ 'end' ] . isoformat ( ) num_counter += 1 return d
Take a reporter editions dict and flatten it, returning a dict for
    use in the DictWriter.