'Delete an object.
:type obj: :class:`Object`
:param obj: Object instance.
:return: ``bool`` True on success.
:rtype: ``bool``'

def delete_object(self, obj):

    path = self.get_object_cdn_url(obj)
    with LockLocalStorage(path):
        try:
            os.unlink(path)
        except Exception:
            return False
    path = os.path.dirname(path)
    container_url = obj.container.get_cdn_url()
    while (path != container_url):
        try:
            os.rmdir(path)
        except OSError:
            exp = sys.exc_info()[1]
            if (exp.errno == errno.ENOTEMPTY):
                break
            raise exp
        path = os.path.dirname(path)
    return True
