'Update the MusicBrainz collection from a list of Beets albums'

def update_album_list(self, album_list):

    collections = mb_call(musicbrainzngs.get_collections)
    if (not collections['collection-list']):
        raise ui.UserError(u'no    collections    exist    for    user')
    for collection in collections['collection-list']:
        if ('release-count' in collection):
            collection_id = collection['id']
            break
    else:
        raise ui.UserError(u'No    collection    found.')
    album_ids = []
    for album in album_list:
        aid = album.mb_albumid
        if aid:
            if re.match(UUID_REGEX, aid):
                album_ids.append(aid)
            else:
                self._log.info(u'skipping    invalid    MBID:    {0}', aid)
    self._log.info(u'Updating    MusicBrainz    collection    {0}...', collection_id)
    submit_albums(collection_id, album_ids)
    self._log.info(u'...MusicBrainz    collection    updated.')
