Given a URI like local:///srv/repo or s3://key:secret@apt.example.com,
        return a libcloud storage or container object.

def _get_storage(cls, uri):
        """
        Given a URI like local:///srv/repo or s3://key:secret@apt.example.com,
        return a libcloud storage or container object.
        """
        driver = cls._get_driver(uri.scheme)
        key = uri.username
        secret = uri.password
        container = uri.netloc
        driver_kwargs = {}
        if uri.scheme.startswith('s3'):
            if not key:
                key = os.environ.get('AWS_ACCESS_KEY_ID')
            if not secret:
                secret = os.environ.get('AWS_SECRET_ACCESS_KEY')
            if not (key and secret and container):
                raise ValueError('For S3 you must provide an access key ID, secret access key, and bucket name')
            # No way to store this in the URI, what about a CLI option too?
            if 'AWS_TOKEN' in os.environ:
                driver_kwargs['token'] = os.environ['AWS_TOKEN']
        elif uri.scheme == 'local':
            parts = []
            if uri.netloc:
                parts.append(uri.netloc)
            if uri.path:
                parts.append(uri.path)
            if not parts:
                parts.append('.')
            base_path = os.path.abspath(''.join(parts))
            key = os.path.dirname(base_path)
            container = os.path.basename(base_path)
        storage = driver(key, secret, **driver_kwargs)
        try:
            return storage.get_container(container)
        except ContainerDoesNotExistError:
            return storage.create_container(container)