How to take screenshot only for failed test Cases from 100 test cases?

Suppose in a package i have 100 classes for different modules and through testng i have run all and suppose in between any test cases failed so i need screenshot of that only it can be any test cases. How can i do . I am trying this for a long time . But still i am stuck.
Pls check Thanks

@Zeeshan in testNG in afterMethod get testResult status. It it failed take screenshot.

Which framework do you use to run tests?

I am using Hybrid Framework

Unfortunately, I am not familiar with Hybrid Framework

Thanks for the reply. Please tel me in other framework so that i can try.