<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def shorten(self, long_url, custom_ending=None, is_secret=False):
 """ Creates a short url if valid :param str long_url: The url to shorten. :param custom_ending: The custom url to create if available. :type custom_ending: str or None :param bool is_secret: if not public, it's secret :return: a short link :rtype: str """

        params = {
            'url': long_url,
            'is_secret': 'true' if is_secret else 'false',
            'custom_ending': custom_ending
        }
        data, r = self._make_request(self.api_shorten_endpoint, params)
        if r.status_code == 400:
            if custom_ending is not None:
                raise exceptions.CustomEndingUnavailable(custom_ending)
            raise exceptions.BadApiRequest
        elif r.status_code == 403:
            raise exceptions.QuotaExceededError
        action = data.get('action')
        short_url = data.get('result')
        if action == 'shorten' and short_url is not None:
            return short_url
        raise exceptions.DebugTempWarning