<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setCodecPreferences(self, codecs):
 """ Override the default codec preferences. See :meth:`RTCRtpSender.getCapabilities` and :meth:`RTCRtpReceiver.getCapabilities` for the supported codecs. :param: codecs: A list of :class:`RTCRtpCodecCapability`, in decreasing order of preference. If empty, restores the default preferences. """

        if not codecs:
            self._preferred_codecs = []

        capabilities = get_capabilities(self.kind).codecs
        unique = []
        for codec in reversed(codecs):
            if codec not in capabilities:
                raise ValueError('Codec is not in capabilities')
            if codec not in unique:
                unique.insert(0, codec)
        self._preferred_codecs = unique