'Return an object CDN URL.
:param obj: Object instance
:type  obj: :class:`Object`
:param expiry: Expiry
:type expiry: ``str``
:param use_object: Use object
:type use_object: ``bool``
:rtype: ``str``'

def get_object_cdn_url(self, obj, expiry=None, use_object=False):

    if use_object:
        path = ('/rest/objects' + obj.meta_data['object_id'])
    else:
        path = ((('/rest/namespace/' + obj.container.name) + '/') + obj.name)
    if self.secure:
        protocol = 'https'
    else:
        protocol = 'http'
    expiry = str((expiry or (int(time.time()) + self.DEFAULT_CDN_TTL)))
    params = [('uid', self.key), ('expires', expiry)]
    params.append(('signature', self._cdn_signature(path, params, expiry)))
    params = urlencode(params)
    path = (self.path + path)
    return urlparse.urlunparse((protocol, self.host, path, '', params, ''))
