def sync(self, policy, mediaSettings, client=None, clientId=None, title=None, sort=None, libtype=None,<EOL>**kwargs):
from plexapi.sync import SyncItem<EOL>if not self.allowSync:<EOL><INDENT>raise BadRequest('<STR_LIT>')<EOL><DEDENT>args = {}<EOL>for category, value in kwargs.items():<EOL><INDENT>args[category] = self._cleanSearchFilter(category, value, libtype)<EOL><DEDENT>if sort is not None:<EOL><INDENT>args['<STR_LIT>'] = self._cleanSearchSort(sort)<EOL><DEDENT>if libtype is not None:<EOL><INDENT>args['<STR_LIT:type>'] = utils.searchType(libtype)<EOL><DEDENT>myplex = self._server.myPlexAccount()<EOL>sync_item = SyncItem(self._server, None)<EOL>sync_item.title = title if title else self.title<EOL>sync_item.rootTitle = self.title<EOL>sync_item.contentType = self.CONTENT_TYPE<EOL>sync_item.metadataType = self.METADATA_TYPE<EOL>sync_item.machineIdentifier = self._server.machineIdentifier<EOL>key = '<STR_LIT>' % self.key<EOL>sync_item.location = '<STR_LIT>' % (self.uuid, quote_plus(key + utils.joinArgs(args)))<EOL>sync_item.policy = policy<EOL>sync_item.mediaSettings = mediaSettings<EOL>return myplex.sync(client=client, clientId=clientId, sync_item=sync_item)<EOL>
Add current library section as sync item for specified device.
            See description of :func:`~plexapi.library.LibrarySection.search()` for details about filtering / sorting
            and :func:`plexapi.myplex.MyPlexAccount.sync()` for possible exceptions.

            Parameters:
                policy (:class:`plexapi.sync.Policy`): policy of syncing the media (how many items to sync and process
                                                       watched media or not), generated automatically when method
                                                       called on specific LibrarySection object.
                mediaSettings (:class:`plexapi.sync.MediaSettings`): Transcoding settings used for the media, generated
                                                                     automatically when method called on specific
                                                                     LibrarySection object.
                client (:class:`plexapi.myplex.MyPlexDevice`): sync destination, see
                                                               :func:`plexapi.myplex.MyPlexAccount.sync`.
                clientId (str): sync destination, see :func:`plexapi.myplex.MyPlexAccount.sync`.
                title (str): descriptive title for the new :class:`plexapi.sync.SyncItem`, if empty the value would be
                             generated from metadata of current media.
                sort (str): formatted as `column:dir`; column can be any of {`addedAt`, `originallyAvailableAt`,
                            `lastViewedAt`, `titleSort`, `rating`, `mediaHeight`, `duration`}. dir can be `asc` or
                            `desc`.
                libtype (str): Filter results to a specific libtype (`movie`, `show`, `episode`, `artist`, `album`,
                               `track`).

            Returns:
                :class:`plexapi.sync.SyncItem`: an instance of created syncItem.

            Raises:
                :class:`plexapi.exceptions.BadRequest`: when the library is not allowed to sync

            Example:

                .. code-block:: python

                    from plexapi import myplex
                    from plexapi.sync import Policy, MediaSettings, VIDEO_QUALITY_3_MBPS_720p

                    c = myplex.MyPlexAccount()
                    target = c.device('Plex Client')
                    sync_items_wd = c.syncItems(target.clientIdentifier)
                    srv = c.resource('Server Name').connect()
                    section = srv.library.section('Movies')
                    policy = Policy('count', unwatched=True, value=1)
                    media_settings = MediaSettings.create(VIDEO_QUALITY_3_MBPS_720p)
                    section.sync(target, policy, media_settings, title='Next best movie', sort='rating:desc')