'Setup assets. Save in store if given'

def setup_assets(self, course1_key, course2_key, store=None):

    for (i, asset) in enumerate(AssetStoreTestData.all_asset_data):
        asset_dict = dict(zip(AssetStoreTestData.asset_fields[1:], asset[1:]))
        if ((i in (0, 1)) and course1_key):
            asset_key = course1_key.make_asset_key('asset', asset[0])
            asset_md = AssetMetadata(asset_key, **asset_dict)
            if (store is not None):
                store.save_asset_metadata(asset_md, asset[4])
        elif course2_key:
            asset_key = course2_key.make_asset_key('asset', asset[0])
            asset_md = AssetMetadata(asset_key, **asset_dict)
            if ((store is not None) and (i not in (4, 5))):
                store.save_asset_metadata(asset_md, asset[4])
