Return (tree_id, tree) or None (if the tree has no edges).

def convert_tree(self, tree):
        """Return (tree_id, tree) or None (if the tree has no edges).
        """
        nodeById = {}
        root_node = None
        node_list = _index_list_of_values(tree, 'node')
        for node in node_list:
            nodeById[node['@id']] = node
            r = node.get('@root')
            # _LOG.debug(' node {} @root={}'.format(node['@id'], r))
            if r in [True, 'true']:  # @TEMP accepting true or "true"
                assert root_node is None
                root_node = node
        assert root_node is not None
        edgeBySourceId = {}
        edge_list = _get_index_list_of_values(tree, 'edge')
        for edge in edge_list:
            sourceId = edge['@source']
            eid = edge['@id']
            del edge['@id']
            byso = edgeBySourceId.setdefault(sourceId, {})
            byso[eid] = edge
        # If all that succeeds, add the new object to the dict, creating a fat structure
        tree['nodeById'] = nodeById
        tree['edgeBySourceId'] = edgeBySourceId
        tree['^ot:rootNodeId'] = root_node['@id']
        # Make the struct leaner
        tid = tree['@id']
        if self.remove_old_structs:
            del tree['@id']
            del tree['node']
            try:
                del tree['edge']
            except:
                # Tree Tr75035 in http://treebase.org/treebase-web/search/study/summary.html?id=14763
                #   is empty. in NeXML that shows up as a tree with a node but no edges.
                #   See https://github.com/OpenTreeOfLife/opentree/issues/641
                # TODO: returning None seems safest, but could cull trees with just metadata.
                #       but creating a fake tree for metadata is ugly. So, I'm fine with not
                #       supporting this.
                _LOG.warn('Tree with ID "{}" is being dropped because it has no edges'.format(tid))
                assert not edge_list
                return None
            for node in node_list:
                if '^ot:isLeaf' in node:
                    del node['^ot:isLeaf']
                del node['@id']
        return tid, tree