def find_dependency_in_spec(spec, ref):
    """Utility to return the dict corresponding to the given ref
    in a dependency build spec document fragment
    """
    for item in spec:
        if item['ref'] == ref:
            return item