<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_collection(self, service_name, collection_name, base_class=None):
 """ Retrieves a collection class from the cache, if available. :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 base_class: (Optional) The base class of the object. Prevents "magically" loading the wrong class (one with a different base). Default is ``default``. :type base_class: class :returns: A <kotocore.collections.Collection> subclass """

        classpath = self.build_classpath(base_class)
        service = self.services.get(service_name, {})
        collections = service.get('collections', {})
        collection_options = collections.get(collection_name, {})
        collection_class = collection_options.get(classpath, None)

        if not collection_class:
            msg = "Collection '{0}' for {1} is not present in the cache."
            raise NotCached(msg.format(
                collection_name,
                service_name
            ))

        return collection_class