def write_metadata(metadata, cfg, file_root):
    for key in metadata:
        city = key.replace(' ', '_')
        directory = os.path.join(file_root, city)
        if (not os.path.exists(directory)):
            os.mkdir(directory)
        file_path = os.path.join(directory, 'metadata.json')
        dl_flag = cfg['cities'][key]['download']
        if (cfg['cities'][key]['download'] != 'photos'):
            with open(file_path, 'w') as f:
                json.dump(metadata[key], f, indent=2)
def write_metadata(metadata, cfg, file_root):
    for key in metadata:
        city = key.replace(' ', '_')
        directory = os.path.join(file_root, city)
        if (not os.path.exists(directory)):
            os.mkdir(directory)
        file_path = os.path.join(directory, 'metadata.json')
        dl_flag = cfg['cities'][key]['download']
        if (cfg['cities'][key]['download'] != 'photos'):
            with open(file_path, 'w') as f:
                json.dump(metadata[key], f, indent=2)