Appends an asset to a composition.

        arg:    asset_id (osid.id.Id): ``Id`` of the ``Asset``
        arg:    composition_id (osid.id.Id): ``Id`` of the
                ``Composition``
        raise:  AlreadyExists - ``asset_id`` already part
                ``composition_id``
        raise:  NotFound - ``asset_id`` or ``composition_id`` not found
        raise:  NullArgument - ``asset_id`` or ``composition_id`` is
                ``null``
        raise:  OperationFailed - unable to complete request
        raise:  PermissionDenied - authorization fauilure
        *compliance: mandatory -- This method must be implemented.*

def add_asset(self, asset_id, composition_id):
        """Appends an asset to a composition.

        arg:    asset_id (osid.id.Id): ``Id`` of the ``Asset``
        arg:    composition_id (osid.id.Id): ``Id`` of the
                ``Composition``
        raise:  AlreadyExists - ``asset_id`` already part
                ``composition_id``
        raise:  NotFound - ``asset_id`` or ``composition_id`` not found
        raise:  NullArgument - ``asset_id`` or ``composition_id`` is
                ``null``
        raise:  OperationFailed - unable to complete request
        raise:  PermissionDenied - authorization fauilure
        *compliance: mandatory -- This method must be implemented.*

        """
        # The asset found check may want to be run through _get_provider_manager
        # so as to ensure access control:
        from dlkit.abstract_osid.id.primitives import Id as ABCId
        if not isinstance(asset_id, ABCId):
            raise errors.InvalidArgument('the argument is not a valid OSID Id')
        if (not isinstance(composition_id, ABCId) and
                composition_id.get_identifier_namespace() != 'repository.Composition'):
            raise errors.InvalidArgument('the argument is not a valid OSID Id')
        if asset_id.get_identifier_namespace() != 'repository.Asset':
            if asset_id.get_authority() != self._authority:
                raise errors.InvalidArgument()
            else:
                mgr = self._get_provider_manager('REPOSITORY')
                admin_session = mgr.get_asset_admin_session_for_repository(self._catalog_id, proxy=self._proxy)
                asset_id = admin_session._get_asset_id_with_enclosure(asset_id)
        collection = JSONClientValidated('repository',
                                         collection='Asset',
                                         runtime=self._runtime)
        asset = collection.find_one({'_id': ObjectId(asset_id.get_identifier())})
        collection = JSONClientValidated('repository',
                                         collection='Composition',
                                         runtime=self._runtime)
        composition = collection.find_one({'_id': ObjectId(composition_id.get_identifier())})
        if 'assetIds' in composition:
            if str(asset_id) not in composition['assetIds']:
                composition['assetIds'].append(str(asset_id))
        else:
            composition['assetIds'] = [str(asset_id)]
        collection.save(composition)