def get_tree(self, name=None, backup=None, root=None, agent=None):
        """See :func:`burpui.misc.backend.interface.BUIbackend.get_tree`"""
        ret = []
        if not name or not backup:
            return ret
        if not root:
            top = ''
        else:
            try:
                top = root.decode('utf-8', 'replace')
            except UnicodeDecodeError:
                top = root

        query = self.status('c:{0}:b:{1}:p:{2}\n'.format(name, backup, top))
        if not query:
            return ret
        try:
            backup = query['clients'][0]['backups'][0]
        except KeyError as e:
            return ret
        for entry in backup['browse']['entries']:
            data = {}
            if entry['name'] == '.':
                continue
            else:
                data['name'] = entry['name']
            data['mode'] = self._human_st_mode(entry['mode'])
            if re.match('^(d|l)', data['mode']):
                data['type'] = 'd'
            else:
                data['type'] = 'f'
            data['inodes'] = entry['nlink']
            data['uid'] = entry['uid']
            data['gid'] = entry['gid']
            data['parent'] = top
            data['size'] = '{0:.1eM}'.format(_hr(entry['size']))
            data['date'] = entry['mtime']
            ret.append(data)
        return ret
dataset/ETHPy150Open ziirish/burp-ui/burpui/misc/backend/burp2.py/Burp.get_tree/original