'Write intermediate mbnames file in JSON format.'

def write(self):

    itemlist = []
    for foldername in self._foldernames:
        if self._folderfilter(self._accountname, foldername):
            itemlist.append({'accountname': self._accountname, 'foldername': foldername.decode('utf-8'), 'localfolders': self._folder_root})
    if self._dryrun:
        self.ui.info(('mbnames    would    write    %s' % self._path))
    else:
        with codecs.open(self._path, 'wt', encoding='UTF-8') as intermediateFD:
            json.dump(itemlist, intermediateFD)
