def open_connection(func):
@wraps(func)<EOL>def wrapped_func(*args, **kwargs):  <EOL><INDENT>if kwargs.get('<STR_LIT>', None) is None:<EOL><INDENT>try:<EOL><INDENT>host = kwargs.pop('<STR_LIT:host>')<EOL><DEDENT>except KeyError:<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>kwargs['<STR_LIT>'] = auth_connect(host, kwargs.pop('<STR_LIT:port>', None))<EOL><DEDENT>return func(*args, **kwargs)<EOL><DEDENT>return wrapped_func<EOL>
Decorate a function to create a `nds2.connection` if required