def remote_app(self, name, version=None, **kwargs):
if version is None:<EOL><INDENT>if '<STR_LIT>' in kwargs:<EOL><INDENT>version = '<STR_LIT:1>'<EOL><DEDENT>else:<EOL><INDENT>version = '<STR_LIT:2>'<EOL><DEDENT><DEDENT>if version == '<STR_LIT:1>':<EOL><INDENT>remote_app = OAuth1Application(name, clients=cached_clients)<EOL><DEDENT>elif version == '<STR_LIT:2>':<EOL><INDENT>remote_app = OAuth2Application(name, clients=cached_clients)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % version)<EOL><DEDENT>return self.add_remote_app(remote_app, **kwargs)<EOL>
Creates and adds new remote application.

        :param name: the remote application's name.
        :param version: '1' or '2', the version code of OAuth protocol.
        :param kwargs: the attributes of remote application.