<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_collection(self, service_name, collection_name, to_cache):
 """ Sets a collection class within the cache. :param service_name: The service a given ``Collection`` talks to. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :param collection_name: The name of the ``Collection``. Ex. ``QueueCollection``, ``NotificationCollection``, ``TableCollection``, etc. :type collection_name: string :param to_cache: The class to be cached for the service. :type to_cache: class """

        self.services.setdefault(service_name, {})
        self.services[service_name].setdefault('collections', {})
        self.services[service_name]['collections'].setdefault(collection_name, {})
        options = self.services[service_name]['collections'][collection_name]
        classpath = self.build_classpath(to_cache.__bases__[0])

        if classpath == 'kotocore.collections.Collection':
            classpath = 'default'

        options[classpath] = to_cache