A topological method for the classification of entanglements in crystal networks