'Usage: download [remotepath] [localpath] - download a remote directory (recursively) / file
remotepath - remote path at Baidu Yun (after app root directory), if not specified, it is set to the root directory at Baidu Yun
localpath - local path. if not specified, it is set to the current directory'

def download(self, remotepath=u'/', localpath=u''):

    subr = self.get_file_info(remotepath)
    if (const.ENoError == subr):
        if (u'isdir' in self.__remote_json):
            if self.__remote_json[u'isdir']:
                return self.downdir(remotepath, localpath)
            else:
                return self.downfile(remotepath, localpath)
        else:
            perr(u"Malformed    path    info    JSON    '{}'    returned".format(self.__remote_json))
            return const.EFatal
    elif (const.EFileNotFound == subr):
        perr(u"Remote    path    '{}'    does    not    exist".format(remotepath))
        return subr
    else:
        perr(u"Error    {}    while    getting    info    for    remote    path    '{}'".format(subr, remotepath))
        return subr
