'Read in assets XML file, parse it, and add all asset metadata to the modulestore.'

def import_asset_metadata(self, data_dir, course_id):

    asset_dir = (path(data_dir) / AssetMetadata.EXPORTED_ASSET_DIR)
    assets_filename = AssetMetadata.EXPORTED_ASSET_FILENAME
    asset_xml_file = (asset_dir / assets_filename)
    def make_asset_id(course_id, asset_xml):
        '\n                                                Construct    an    asset    ID    out    of    a    complete    asset    XML    section.\n                                                '
        asset_type = None
        asset_name = None
        for child in asset_xml.iterchildren():
            if (child.tag == AssetMetadata.ASSET_TYPE_ATTR):
                asset_type = child.text
            elif (child.tag == AssetMetadata.ASSET_BASENAME_ATTR):
                asset_name = child.text
        return course_id.make_asset_key(asset_type, asset_name)
    all_assets = []
    try:
        xml_data = etree.parse(asset_xml_file).getroot()
        assert (xml_data.tag == AssetMetadata.ALL_ASSETS_XML_TAG)
        for asset in xml_data.iterchildren():
            if (asset.tag == AssetMetadata.ASSET_XML_TAG):
                asset_key = make_asset_id(course_id, asset)
                asset_md = AssetMetadata(asset_key)
                asset_md.from_xml(asset)
                all_assets.append(asset_md)
    except IOError:
        logging.info('No    %s    file    is    present    with    asset    metadata.', assets_filename)
        return
    except Exception:
        logging.exception('Error    while    parsing    asset    xml.')
        if self.raise_on_failure:
            raise
        else:
            return
    if (len(all_assets) > 0):
        self.store.save_asset_metadata_list(all_assets, all_assets[0].edited_by, import_only=True)
