'Establish a connection with the API server.
:type host: ``str``
:param host: Optional host to override our default
:type port: ``int``
:param port: Optional port to override our default
:returns: A connection'

def connect(self, host=None, port=None, base_url=None, **kwargs):

    connection = None
    secure = self.secure
    if (getattr(self, 'base_url', None) and (base_url is None)):
        (host, port, secure, request_path) = self._tuple_from_url(getattr(self, 'base_url'))
    elif (base_url is not None):
        (host, port, secure, request_path) = self._tuple_from_url(base_url)
    else:
        host = (host or self.host)
        port = (port or self.port)
    port = int(port)
    if (not hasattr(kwargs, 'host')):
        kwargs.update({'host': host})
    if (not hasattr(kwargs, 'port')):
        kwargs.update({'port': port})
    if (not hasattr(kwargs, 'secure')):
        kwargs.update({'secure': self.secure})
    if ((not hasattr(kwargs, 'key_file')) and hasattr(self, 'key_file')):
        kwargs.update({'key_file': getattr(self, 'key_file')})
    if ((not hasattr(kwargs, 'cert_file')) and hasattr(self, 'cert_file')):
        kwargs.update({'cert_file': getattr(self, 'cert_file')})
    if (self.timeout and (not PY25)):
        kwargs.update({'timeout': self.timeout})
    if self.proxy_url:
        kwargs.update({'proxy_url': self.proxy_url})
    connection = self.conn_class(**kwargs)
    self.connection = connection
