An algorithm to detect laminar 3-manifolds