Identify a parent prefix we should add to resources if present in a caller name.

def _parent_prefix(prefix):
    """Identify a parent prefix we should add to resources if present in a caller name.
    """
    def run(algs):
        for alg in algs:
            vcs = alg.get("variantcaller")
            if vcs:
                if isinstance(vcs, dict):
                    vcs = reduce(operator.add, vcs.values())
                if not isinstance(vcs, (list, tuple)):
                    vcs = [vcs]
                return any(vc.startswith(prefix) for vc in vcs if vc)
    return run