code: def find_tree_root(tree, key):
      
      result = [p for p in tree.keys() if p.key == key]
      assert len(result) in [0, 1]
      return None if len(result) == 0 else result[0]
docs: Find a root in a tree by it's key
  
      :param dict tree: the pkg dependency tree obtained by calling
                       `construct_tree` function
      :param str key: key of the root node to find
      :returns: a root node if found else None
      :rtype: mixed