'Takes the same arguments as the :class:`EnvironBuilder` class with
some additions:  You can provide a :class:`EnvironBuilder` or a WSGI
environment as only argument instead of the :class:`EnvironBuilder`
arguments and two optional keyword arguments (`as_tuple`, `buffered`)
that change the type of the return value or the way the application is
executed.
.. versionchanged:: 0.5
If a dict is provided as file in the dict for the `data` parameter
the content type has to be called `content_type` now instead of
`mimetype`.  This change was made for consistency with
:class:`werkzeug.FileWrapper`.
The `follow_redirects` parameter was added to :func:`open`.
Additional parameters:
:param as_tuple: Returns a tuple in the form ``(environ, result)``
:param buffered: Set this to True to buffer the application run.
This will automatically close the application for
you as well.
:param follow_redirects: Set this to True if the `Client` should
follow HTTP redirects.'

def open(self, *args, **kwargs):

    as_tuple = kwargs.pop('as_tuple', False)
    buffered = kwargs.pop('buffered', False)
    follow_redirects = kwargs.pop('follow_redirects', False)
    environ = None
    if ((not kwargs) and (len(args) == 1)):
        if isinstance(args[0], EnvironBuilder):
            environ = args[0].get_environ()
        elif isinstance(args[0], dict):
            environ = args[0]
    if (environ is None):
        builder = EnvironBuilder(*args, **kwargs)
        try:
            environ = builder.get_environ()
        finally:
            builder.close()
    response = self.run_wsgi_app(environ, buffered=buffered)
    redirect_chain = []
    while 1:
        status_code = int(response[1].split(None, 1)[0])
        if ((status_code not in (301, 302, 303, 305, 307)) or (not follow_redirects)):
            break
        new_location = response[2]['location']
        new_redirect_entry = (new_location, status_code)
        if (new_redirect_entry in redirect_chain):
            raise ClientRedirectError('loop    detected')
        redirect_chain.append(new_redirect_entry)
        (environ, response) = self.resolve_redirect(response, new_location, environ, buffered=buffered)
    if (self.response_wrapper is not None):
        response = self.response_wrapper(*response)
    if as_tuple:
        return (environ, response)
    return response
