def pfbranch_to_dict(pf,key): 
    """
    Recursive function to convert a single branch in an AntelopePf to a python dict.
    
    This function utilizes recursion to follow a chain of arbitrary length of 
    branches defined in an AntelopePf object.   Result is a dict with a chain of 
    dicts of the same length.  i.e. if AntelopePf has 3 levels of branches
    the dict will have a 3 levels of associative arrays keyed by the same
    branch names as the Arr items in the original Pf file.  Note this should
    be called from the top level one branch at a time.  i.e. for the parent
    AntelopePf this function should be called once for each returned key by 
    pf.arr_keys().
    
    Note that at each level Tbl& sections of the original pf are parsed to 
    be converted to lists of strings with each line of the Tbl section being
    one string in the list.  
    
    :param pf: is an AntelopePf.  Recursive calls use get_branch outputs 
       that return one of these.
    :param key: key used to access the branch requested
    :type key: string
    :return:  python dict translation of AntelopePf branch structure
    :raise:  RunTime errors are possible from the ccore methods that are called.
    """
    brkeys=pf.arr_keys()
    if(len(brkeys)>0):
        # This loads simple parameters at this level
        allbrdata=pf.todict()
        # This loads any Tbl& data at this level of the hierarchy
        tblkeys=pf.tbl_keys()
        for k in tblkeys:
            tvals=pf.get_tbl(k)
            allbrdata[k]=tvals
        for k in brkeys:
            pfbranch=pf.get_branch(k)
            bk=pfbranch_to_dict(pfbranch,k)
            allbrdata[k]=bk
        return allbrdata
    else:
        brdata=pf.todict()
        return brdata