'Opens a connection to appropriate provider, depending on provider
portion of URI. Requires Credentials defined in boto config file (see
boto/pyami/config.py).
@type storage_uri: StorageUri
@param storage_uri: StorageUri specifying a bucket or a bucket+object
@rtype: L{AWSAuthConnection<boto.gs.connection.AWSAuthConnection>}
@return: A connection to storage service provider of the given URI.'

def connect(self, access_key_id=None, secret_access_key=None, **kwargs):

    connection_args = dict((self.connection_args or ()))
    if (hasattr(self, 'suppress_consec_slashes') and ('suppress_consec_slashes' not in connection_args)):
        connection_args['suppress_consec_slashes'] = self.suppress_consec_slashes
    connection_args.update(kwargs)
    if (not self.connection):
        if (self.scheme in self.provider_pool):
            self.connection = self.provider_pool[self.scheme]
        elif (self.scheme == 's3'):
            from boto.s3.connection import S3Connection
            self.connection = S3Connection(access_key_id, secret_access_key, **connection_args)
            self.provider_pool[self.scheme] = self.connection
        elif (self.scheme == 'gs'):
            from boto.gs.connection import GSConnection
            from boto.s3.connection import OrdinaryCallingFormat
            connection_args['calling_format'] = OrdinaryCallingFormat()
            self.connection = GSConnection(access_key_id, secret_access_key, **connection_args)
            self.provider_pool[self.scheme] = self.connection
        elif (self.scheme == 'file'):
            from boto.file.connection import FileConnection
            self.connection = FileConnection(self)
        else:
            raise InvalidUriError(('Unrecognized    scheme    "%s"' % self.scheme))
    self.connection.debug = self.debug
    return self.connection
