'Downloads the given app+version.'

def DownloadApp(self):

    if (len(self.args) != 1):
        self.parser.error((('"download_app"    expects    one    non-option    argument,    found    ' + str(len(self.args))) + '.'))
    out_dir = self.args[0]
    app_id = self.options.app_id
    if (app_id is None):
        self.parser.error('You    must    specify    an    app    ID    via    -A    or    --application.')
    module = self.options.module
    app_version = self.options.version
    if os.path.exists(out_dir):
        if (not os.path.isdir(out_dir)):
            self.parser.error(('Cannot    download    to    path    "%s":    there\'s    a    file    in    the    way.' % out_dir))
        elif os.listdir(out_dir):
            self.parser.error(('Cannot    download    to    path    "%s":    directory    already    exists    and    it    isn\'t    empty.' % out_dir))
    rpcserver = self._GetRpcServer()
    DoDownloadApp(rpcserver, out_dir, app_id, module, app_version)
