Recognising mapping classes